Module: ForemanMaintain::Cli::TransformClampOptions::OptionsToParams

Defined in:
lib/foreman_maintain/cli/transform_clamp_options.rb

Instance Method Summary collapse

Instance Method Details

#get_params_for(definition) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/foreman_maintain/cli/transform_clamp_options.rb', line 17

def get_params_for(definition)
  all_params = options_to_params
  params = {}
  definition.params.each_value do |param|
    params[param.name] = all_params[param.name]
  end
  params
end

#options_to_paramsObject



10
11
12
13
14
15
# File 'lib/foreman_maintain/cli/transform_clamp_options.rb', line 10

def options_to_params
  @params ||= self.class.recognised_options.inject({}) do |par, option|
    par[option_sym(option)] = send(option.read_method) if (option)
    par
  end
end