Class: HammerCLI::Apipie::OptionBuilder
- Inherits:
-
HammerCLI::AbstractOptionBuilder
- Object
- HammerCLI::AbstractOptionBuilder
- HammerCLI::Apipie::OptionBuilder
- Defined in:
- lib/hammer_cli/apipie/option_builder.rb
Instance Attribute Summary collapse
-
#require_options ⇒ Object
writeonly
Sets the attribute require_options.
Instance Method Summary collapse
- #build(builder_params = {}) ⇒ Object
-
#initialize(resource, action, options = {}) ⇒ OptionBuilder
constructor
A new instance of OptionBuilder.
- #require_options? ⇒ Boolean
Constructor Details
#initialize(resource, action, options = {}) ⇒ OptionBuilder
Returns a new instance of OptionBuilder.
6 7 8 9 10 |
# File 'lib/hammer_cli/apipie/option_builder.rb', line 6 def initialize(resource, action, ={}) @action = action @resource = resource @require_options = [:require_options].nil? ? true : [:require_options] end |
Instance Attribute Details
#require_options=(value) ⇒ Object (writeonly)
Sets the attribute require_options
19 20 21 |
# File 'lib/hammer_cli/apipie/option_builder.rb', line 19 def (value) @require_options = value end |
Instance Method Details
#build(builder_params = {}) ⇒ Object
12 13 14 15 16 17 |
# File 'lib/hammer_cli/apipie/option_builder.rb', line 12 def build(builder_params = {}) filter = Array(builder_params[:without]) resource_name_map = builder_params[:resource_mapping] || {} (@action.params, filter, resource_name_map, command: builder_params[:command]) end |
#require_options? ⇒ Boolean
20 21 22 |
# File 'lib/hammer_cli/apipie/option_builder.rb', line 20 def @require_options end |