Class: HammerCLIForeman::OptionSources::SelfParam

Inherits:
HammerCLI::Options::Sources::Base
  • Object
show all
Defined in:
lib/hammer_cli_foreman/option_sources/self_param.rb

Instance Method Summary collapse

Constructor Details

#initialize(command) ⇒ SelfParam

Returns a new instance of SelfParam.



4
5
6
# File 'lib/hammer_cli_foreman/option_sources/self_param.rb', line 4

def initialize(command)
  @command = command
end

Instance Method Details

#get_options(defined_options, result) ⇒ Object



8
9
10
11
12
13
# File 'lib/hammer_cli_foreman/option_sources/self_param.rb', line 8

def get_options(defined_options, result)
  # resolve 'id' parameter if it's defined as an option
  id_option_name = HammerCLI.option_accessor_name('id')
  result[id_option_name] ||= @command.get_identifier(result) if @command.respond_to?(id_option_name)
  result
end