Class: MagicReport::Report::Configuration::Field

Inherits:
Object
  • Object
show all
Defined in:
lib/magic_report/report/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key:, processor: nil) ⇒ Field

Returns a new instance of Field.



9
10
11
12
# File 'lib/magic_report/report/configuration.rb', line 9

def initialize(key:, processor: nil)
  @key = key
  @processor = processor
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



7
8
9
# File 'lib/magic_report/report/configuration.rb', line 7

def key
  @key
end

#processorObject (readonly)

Returns the value of attribute processor.



7
8
9
# File 'lib/magic_report/report/configuration.rb', line 7

def processor
  @processor
end

Instance Method Details

#process(entity) ⇒ Object



14
15
16
# File 'lib/magic_report/report/configuration.rb', line 14

def process(entity)
  processor ? processor.call(entity) : entity.send(key)
end