Class: HammerCLI::Options::OptionCollector
- Inherits:
-
Object
- Object
- HammerCLI::Options::OptionCollector
- Defined in:
- lib/hammer_cli/options/option_collector.rb
Instance Attribute Summary collapse
-
#option_processor ⇒ Object
Returns the value of attribute option_processor.
Instance Method Summary collapse
- #all_options ⇒ Object
- #all_options_raw ⇒ Object
-
#initialize(recognised_options, option_processor) ⇒ OptionCollector
constructor
A new instance of OptionCollector.
- #options ⇒ Object
Constructor Details
#initialize(recognised_options, option_processor) ⇒ OptionCollector
Returns a new instance of OptionCollector.
6 7 8 9 10 11 12 13 14 |
# File 'lib/hammer_cli/options/option_collector.rb', line 6 def initialize(, option_processor) @recognised_options = if !option_processor.is_a?(HammerCLI::Options::ProcessorList) @option_processor = HammerCLI::Options::ProcessorList.new(option_processor) else @option_processor = option_processor end end |
Instance Attribute Details
#option_processor ⇒ Object
Returns the value of attribute option_processor.
4 5 6 |
# File 'lib/hammer_cli/options/option_collector.rb', line 4 def option_processor @option_processor end |
Instance Method Details
#all_options ⇒ Object
20 21 22 |
# File 'lib/hammer_cli/options/option_collector.rb', line 20 def @all_options ||= translate_nils() end |
#all_options_raw ⇒ Object
16 17 18 |
# File 'lib/hammer_cli/options/option_collector.rb', line 16 def @all_options_raw ||= @option_processor.process(@recognised_options, {}) end |
#options ⇒ Object
24 25 26 |
# File 'lib/hammer_cli/options/option_collector.rb', line 24 def @options ||= .reject { |key, value| value.nil? && [key].nil? } end |