Module: Ergane::Concerns::OptionHandling::ClassMethods
- Defined in:
- lib/ergane/concerns/option_handling.rb
Instance Method Summary collapse
- #argument_definitions ⇒ Object
- #build_default_options ⇒ Object
- #build_option_parser(store) ⇒ Object
- #option_definitions ⇒ Object
Instance Method Details
#argument_definitions ⇒ Object
15 16 17 |
# File 'lib/ergane/concerns/option_handling.rb', line 15 def argument_definitions @argument_definitions ||= [] end |
#build_default_options ⇒ Object
19 20 21 22 23 |
# File 'lib/ergane/concerns/option_handling.rb', line 19 def option_definitions.each_with_object({}) do |(name, defn), hash| hash[name] = defn.default_value end end |
#build_option_parser(store) ⇒ Object
25 26 27 28 29 30 31 |
# File 'lib/ergane/concerns/option_handling.rb', line 25 def build_option_parser(store) ::OptionParser.new do |parser| option_definitions.each_value do |defn| defn.attach(parser, store) end end end |
#option_definitions ⇒ Object
11 12 13 |
# File 'lib/ergane/concerns/option_handling.rb', line 11 def option_definitions @option_definitions ||= {} end |