Module: Unnatural::Split
- Defined in:
- lib/unnatural/split.rb
Constant Summary collapse
- SPLITTER =
/(?<=\d)(?=\D)|(?<=\D)(?=\d)/
- PRED =
['0'.ord.pred.chr].freeze
Class Method Summary collapse
Class Method Details
.compare(a, b) ⇒ Object
10 11 12 |
# File 'lib/unnatural/split.rb', line 10 def self.compare(a, b) split(a) <=> split(b) end |
.sort(enumerable) ⇒ Object
6 7 8 |
# File 'lib/unnatural/split.rb', line 6 def self.sort(enumerable) enumerable.sort_by { |s| split(s) } end |