Module: Skeptick::Helper
- Defined in:
- lib/skeptick/helper.rb
Class Method Summary collapse
- .extract_options!(array) ⇒ Object
- .object_to_index_range_list(obj) ⇒ Object
- .process_args(*args) ⇒ Object
Class Method Details
.extract_options!(array) ⇒ Object
5 6 7 |
# File 'lib/skeptick/helper.rb', line 5 def (array) array.last.is_a?(Hash) ? array.pop : {} end |
.object_to_index_range_list(obj) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/skeptick/helper.rb', line 9 def object_to_index_range_list(obj) case obj when Integer, String obj when Range "#{obj.min}-#{obj.max}" when Array obj.join(',') else raise "invalid sequence reference" end end |
.process_args(*args) ⇒ Object
22 23 24 |
# File 'lib/skeptick/helper.rb', line 22 def process_args(*args) args.map{ |arg| arg.is_a?(Symbol) ? "-#{arg.to_s}" : arg }.join(' ') end |