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.



397
398
399
400
# File 'lib/hammer_cli_foreman/option_builders.rb', line 397

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

Instance Attribute Details

#resourceObject (readonly)

Returns the value of attribute resource.



402
403
404
# File 'lib/hammer_cli_foreman/option_builders.rb', line 402

def resource
  @resource
end

Instance Method Details

#build(builder_params = {}) ⇒ Object



404
405
406
407
408
409
410
411
412
413
414
415
# File 'lib/hammer_cli_foreman/option_builders.rb', line 404

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