Module: NaturalSort
- Defined in:
- lib/natural_sort.rb,
lib/natural_sort/segment.rb,
lib/natural_sort/version.rb,
lib/natural_sort/refinements.rb,
lib/natural_sort/segmented_string.rb
Defined Under Namespace
Classes: Segment, SegmentedString
Constant Summary
collapse
- VERSION =
"0.3.0".freeze
Class Method Summary
collapse
Class Method Details
.compare(a, b) ⇒ Object
21
22
23
|
# File 'lib/natural_sort.rb', line 21
def compare(a, b)
SegmentedString.new(a) <=> SegmentedString.new(b)
end
|
.sort(input) ⇒ Object
13
14
15
|
# File 'lib/natural_sort.rb', line 13
def sort(input)
input.sort(&self)
end
|
.sort!(input) ⇒ Object
17
18
19
|
# File 'lib/natural_sort.rb', line 17
def sort!(input)
input.sort!(&self)
end
|
.to_proc ⇒ Object
9
10
11
|
# File 'lib/natural_sort.rb', line 9
def to_proc
lambda(&method(:compare))
end
|