Module: HammerCLI::Apipie::Options
- Included in:
- Command
- Defined in:
- lib/hammer_cli/apipie/options.rb
Instance Method Summary collapse
- #get_option_value(opt_name) ⇒ Object
- #method_options(options) ⇒ Object
- #method_options_for_params(params, options) ⇒ Object
Instance Method Details
#get_option_value(opt_name) ⇒ Object
29 30 31 32 33 34 35 |
# File 'lib/hammer_cli/apipie/options.rb', line 29 def get_option_value(opt_name) if respond_to?(HammerCLI.option_accessor_name(opt_name), true) send(HammerCLI.option_accessor_name(opt_name)) else nil end end |
#method_options(options) ⇒ Object
5 6 7 |
# File 'lib/hammer_cli/apipie/options.rb', line 5 def () (resource.action(action).params, ) end |
#method_options_for_params(params, options) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/hammer_cli/apipie/options.rb', line 9 def (params, ) opts = {} params.each do |p| if p.expected_type == :hash && !p.params.empty? opts[p.name] = (p.params, ) else p_name = HammerCLI.option_accessor_name(p.name) if .key?(p_name) opts[p.name] = [p_name] elsif respond_to?(p_name, true) opt = send(p_name) opts[p.name] = opt unless opt.nil? end end end opts end |