Module: ForemanRemoteExecution::Exportable::ClassMethods

Defined in:
app/models/concerns/foreman_remote_execution/exportable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#exportable_attributesObject (readonly)

Returns the value of attribute exportable_attributes.



54
55
56
# File 'app/models/concerns/foreman_remote_execution/exportable.rb', line 54

def exportable_attributes
  @exportable_attributes
end

Instance Method Details

#attr_exportable(*args) ⇒ Object

Takes an array of exportable attributes, and a custom exports hash. The custom exports hash should be a key/lambda pair used to export the particular attribute.



59
60
61
62
63
64
65
66
67
68
# File 'app/models/concerns/foreman_remote_execution/exportable.rb', line 59

def attr_exportable(*args)
  @exportable_attributes ||= {}
  args.each do |arg|
    if arg.is_a?(Hash)
      @exportable_attributes.merge!(arg)
    else
      @exportable_attributes.merge!(arg => arg)
    end
  end
end