Module: SleipnirAPI::OptionUtil
- Included in:
- Profile::OptionArgument, Searcher
- Defined in:
- lib/sleipnir_api/util.rb
Overview
:nodoc:
Class Method Summary collapse
Class Method Details
.parse_option_arguments(*options) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/sleipnir_api/util.rb', line 24 def parse_option_arguments(*) result = {} rest = [] .flatten.compact.map{|e| Symbol === e ? e.to_s : e }.each do |opt| case opt when /\A(?:no|without)_(.+)/ result[$1.to_sym] = false when /\A(?:with)_(.+)/ result[$1.to_sym] = true when /(.+)/ result[$1.to_sym] = true when Hash result.update(opt) else rest << opt end end [result, rest] end |