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.



365
366
367
368
# File 'lib/hammer_cli_foreman/option_builders.rb', line 365

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

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource.



370
371
372
# File 'lib/hammer_cli_foreman/option_builders.rb', line 370

def resource
  @resource
end

Instance Method Details

#build(builder_params = {}) ⇒ Object



372
373
374
375
376
377
378
379
380
381
382
383
# File 'lib/hammer_cli_foreman/option_builders.rb', line 372

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