module NaturalSort
Constants
- VERSION
Public Instance Methods
compare(a, b)
click to toggle source
# File lib/natural_sort.rb, line 21 def compare(a, b) SegmentedString.new(a) <=> SegmentedString.new(b) end
natural_sort()
click to toggle source
# File lib/natural_sort/refinements.rb, line 6 def natural_sort to_a.sort(&NaturalSort) end
natural_sort_by() { |element| ... }
click to toggle source
# File lib/natural_sort/refinements.rb, line 10 def natural_sort_by to_a.sort_by do |element| NaturalSort(yield(element)) end end
sort(input)
click to toggle source
# File lib/natural_sort.rb, line 13 def sort(input) input.sort(&self) end
sort!(input)
click to toggle source
# File lib/natural_sort.rb, line 17 def sort!(input) input.sort!(&self) end
to_proc()
click to toggle source
# File lib/natural_sort.rb, line 9 def to_proc lambda(&method(:compare)) end