Linux moon.hostseba.com 4.18.0-553.51.1.lve.el8.x86_64 #1 SMP Tue May 6 15:14:12 UTC 2025 x86_64
LiteSpeed
Server IP : 103.174.152.68 & Your IP : 216.73.216.9
Domains :
Cant Read [ /etc/named.conf ]
User : julaysp1
Terminal
Auto Root
Create File
Create Folder
Localroot Suggester
Backdoor Destroyer
Readme
/
opt /
alt /
ruby18 /
share /
ri /
1.8 /
system /
Enumerable /
Delete
Unzip
Name
Size
Permission
Date
Action
Enumerator
[ DIR ]
drwxr-xr-x
2023-11-25 20:34
all%3f-i.yaml
856
B
-rw-r--r--
2023-07-26 13:47
any%3f-i.yaml
877
B
-rw-r--r--
2023-07-26 13:47
cdesc-Enumerable.yaml
2.9
KB
-rw-r--r--
2023-07-26 13:47
collect-i.yaml
609
B
-rw-r--r--
2023-07-26 13:47
count-i.yaml
815
B
-rw-r--r--
2023-07-26 13:47
cycle-i.yaml
896
B
-rw-r--r--
2023-07-26 13:47
detect-i.yaml
732
B
-rw-r--r--
2023-07-26 13:47
drop-i.yaml
435
B
-rw-r--r--
2023-07-26 13:47
drop_while-i.yaml
539
B
-rw-r--r--
2023-07-26 13:47
each_cons-i.yaml
633
B
-rw-r--r--
2023-07-26 13:47
each_slice-i.yaml
563
B
-rw-r--r--
2023-07-26 13:47
each_with_index-i.yaml
609
B
-rw-r--r--
2023-07-26 13:47
entries-i.yaml
546
B
-rw-r--r--
2023-07-26 13:47
enum_cons-i.yaml
633
B
-rw-r--r--
2023-07-26 13:47
enum_slice-i.yaml
563
B
-rw-r--r--
2023-07-26 13:47
enum_with_index-i.yaml
609
B
-rw-r--r--
2023-07-26 13:47
find-i.yaml
728
B
-rw-r--r--
2023-07-26 13:47
find_all-i.yaml
541
B
-rw-r--r--
2023-07-26 13:47
find_index-i.yaml
769
B
-rw-r--r--
2023-07-26 13:47
first-i.yaml
455
B
-rw-r--r--
2023-07-26 13:47
grep-i.yaml
845
B
-rw-r--r--
2023-07-26 13:47
group_by-i.yaml
519
B
-rw-r--r--
2023-07-26 13:47
include%3f-i.yaml
585
B
-rw-r--r--
2023-07-26 13:47
inject-i.yaml
209
B
-rw-r--r--
2023-07-26 13:47
map-i.yaml
601
B
-rw-r--r--
2023-07-26 13:47
max-i.yaml
678
B
-rw-r--r--
2023-07-26 13:47
max_by-i.yaml
466
B
-rw-r--r--
2023-07-26 13:47
member%3f-i.yaml
583
B
-rw-r--r--
2023-07-26 13:47
min-i.yaml
678
B
-rw-r--r--
2023-07-26 13:47
min_by-i.yaml
460
B
-rw-r--r--
2023-07-26 13:47
minmax-i.yaml
787
B
-rw-r--r--
2023-07-26 13:47
minmax_by-i.yaml
567
B
-rw-r--r--
2023-07-26 13:47
none%3f-i.yaml
895
B
-rw-r--r--
2023-07-26 13:47
one%3f-i.yaml
893
B
-rw-r--r--
2023-07-26 13:47
partition-i.yaml
537
B
-rw-r--r--
2023-07-26 13:47
reduce-i.yaml
2.05
KB
-rw-r--r--
2023-07-26 13:47
reject-i.yaml
485
B
-rw-r--r--
2023-07-26 13:47
reverse_each-i.yaml
297
B
-rw-r--r--
2023-07-26 13:47
select-i.yaml
537
B
-rw-r--r--
2023-07-26 13:47
sort-i.yaml
926
B
-rw-r--r--
2023-07-26 13:47
sort_by-i.yaml
3.16
KB
-rw-r--r--
2023-07-26 13:47
take-i.yaml
398
B
-rw-r--r--
2023-07-26 13:47
take_while-i.yaml
509
B
-rw-r--r--
2023-07-26 13:47
to_a-i.yaml
540
B
-rw-r--r--
2023-07-26 13:47
to_set-i.yaml
348
B
-rw-r--r--
2023-07-26 13:47
zip-i.yaml
1.01
KB
-rw-r--r--
2023-07-26 13:47
Save
Rename
--- !ruby/object:RI::MethodDescription aliases: [] block_params: comment: - !ruby/struct:SM::Flow::P body: Sorts <em>enum</em> using a set of keys generated by mapping the values in <em>enum</em> through the given block. - !ruby/struct:SM::Flow::VERB body: " %w{ apple pear fig }.sort_by {|word| word.length}\n #=> ["fig", "pear", "apple"]\n" - !ruby/struct:SM::Flow::P body: The current implementation of <tt>sort_by</tt> generates an array of tuples containing the original collection element and the mapped value. This makes <tt>sort_by</tt> fairly expensive when the keysets are simple - !ruby/struct:SM::Flow::VERB body: " require 'benchmark'\n include Benchmark\n\n a = (1..100000).map {rand(100000)}\n\n bm(10) do |b|\n b.report("Sort") { a.sort }\n b.report("Sort by") { a.sort_by {|a| a} }\n end\n" - !ruby/struct:SM::Flow::P body: <em>produces:</em> - !ruby/struct:SM::Flow::VERB body: " user system total real\n Sort 0.180000 0.000000 0.180000 ( 0.175469)\n Sort by 1.980000 0.040000 2.020000 ( 2.013586)\n" - !ruby/struct:SM::Flow::P body: However, consider the case where comparing the keys is a non-trivial operation. The following code sorts some files on modification time using the basic <tt>sort</tt> method. - !ruby/struct:SM::Flow::VERB body: " files = Dir["*"]\n sorted = files.sort {|a,b| File.new(a).mtime <=> File.new(b).mtime}\n sorted #=> ["mon", "tues", "wed", "thurs"]\n" - !ruby/struct:SM::Flow::P body: "This sort is inefficient: it generates two new <tt>File</tt> objects during every comparison. A slightly better technique is to use the <tt>Kernel#test</tt> method to generate the modification times directly." - !ruby/struct:SM::Flow::VERB body: " files = Dir["*"]\n sorted = files.sort { |a,b|\n test(?M, a) <=> test(?M, b)\n }\n sorted #=> ["mon", "tues", "wed", "thurs"]\n" - !ruby/struct:SM::Flow::P body: This still generates many unnecessary <tt>Time</tt> objects. A more efficient technique is to cache the sort keys (modification times in this case) before the sort. Perl users often call this approach a Schwartzian Transform, after Randal Schwartz. We construct a temporary array, where each element is an array containing our sort key along with the filename. We sort this array, and then extract the filename from the result. - !ruby/struct:SM::Flow::VERB body: " sorted = Dir["*"].collect { |f|\n [test(?M, f), f]\n }.sort.collect { |f| f[1] }\n sorted #=> ["mon", "tues", "wed", "thurs"]\n" - !ruby/struct:SM::Flow::P body: This is exactly what <tt>sort_by</tt> does internally. - !ruby/struct:SM::Flow::VERB body: " sorted = Dir["*"].sort_by {|f| test(?M, f)}\n sorted #=> ["mon", "tues", "wed", "thurs"]\n" full_name: Enumerable#sort_by is_singleton: false name: sort_by params: | enum.sort_by {| obj | block } => array visibility: public