Class: Panda::Core::Importable::Configuration

Inherits:
Object
  • Object
show all
Defined in:
app/models/concerns/panda/core/importable.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



22
23
24
# File 'app/models/concerns/panda/core/importable.rb', line 22

def initialize
  @field_definitions = []
end

Instance Attribute Details

#field_definitionsObject (readonly)

Returns the value of attribute field_definitions.



20
21
22
# File 'app/models/concerns/panda/core/importable.rb', line 20

def field_definitions
  @field_definitions
end

Instance Method Details

#field(name, label: name.to_s.humanize, required: false, &transform) ⇒ Object



26
27
28
29
30
31
# File 'app/models/concerns/panda/core/importable.rb', line 26

def field(name, label: name.to_s.humanize, required: false, &transform)
  @field_definitions << FieldDefinition.new(
    name, label: label, required: required,
    transform: block_given? ? transform : nil
  )
end