Module: Refinuri::Utilities
- Included in:
- Refinuri
- Defined in:
- lib/refinuri/utilities.rb
Class Method Summary collapse
Class Method Details
.transcode_range(range_or_string) ⇒ Object
3 4 5 6 7 8 |
# File 'lib/refinuri/utilities.rb', line 3 def self.transcode_range(range_or_string) case range_or_string when Range then "#{range_or_string.first}-#{range_or_string.last}" when String then instance_eval(range_or_string.sub(/-/,'..')) end end |
.transcode_unbounded_range(range) ⇒ Object
10 11 12 13 14 15 16 17 |
# File 'lib/refinuri/utilities.rb', line 10 def self.transcode_unbounded_range(range) case range when /\+$/ then range.chop.concat('..') when /\-$/ then "..".concat(range.chop) when /\.{2}$/ then range.chop.chop.concat('+') when /^\.{2}/ then range.reverse.chop.chop.reverse.concat('-') end end |