Class: HammerCLIForeman::SearchablesUpdateOptionBuilder

Inherits:
SearchablesAbstractOptionBuilder show all
Defined in:
lib/hammer_cli_foreman/option_builders.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(resource, searchables) ⇒ SearchablesUpdateOptionBuilder

Returns a new instance of SearchablesUpdateOptionBuilder.



296
297
298
299
# File 'lib/hammer_cli_foreman/option_builders.rb', line 296

def initialize(resource, searchables)
  @resource = resource
  @searchables = searchables
end

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource.



301
302
303
# File 'lib/hammer_cli_foreman/option_builders.rb', line 301

def resource
  @resource
end

Instance Method Details

#build(builder_params = {}) ⇒ Object



303
304
305
306
307
308
309
310
311
312
313
314
# File 'lib/hammer_cli_foreman/option_builders.rb', line 303

def build(builder_params={})

  @searchables.for(@resource).collect do |s|
    if s.editable?
      option(
        optionamize("--new-#{s.name}"),
        "NEW_#{s.name.upcase}",
        description(s.name, :update)
      )
    end
  end.compact
end