Class: HammerCLI::Options::Sources::CommandLine

Inherits:
Base show all
Defined in:
lib/hammer_cli/options/sources/command_line.rb

Instance Method Summary collapse

Methods inherited from Base

#process

Methods inherited from OptionProcessor

#name, #process

Constructor Details

#initialize(command) ⇒ CommandLine

Returns a new instance of CommandLine.



7
8
9
# File 'lib/hammer_cli/options/sources/command_line.rb', line 7

def initialize(command)
  @command = command
end

Instance Method Details

#get_options(defined_options, result) ⇒ Object



11
12
13
14
15
16
# File 'lib/hammer_cli/options/sources/command_line.rb', line 11

def get_options(defined_options, result)
  defined_options.each do |opt|
    result[opt.attribute_name] ||= @command.send(opt.read_method)
  end
  result
end