Class: MagicReport::Report::Configuration::Field
- Inherits:
-
Object
- Object
- MagicReport::Report::Configuration::Field
- Defined in:
- lib/magic_report/report/configuration.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#processor ⇒ Object
readonly
Returns the value of attribute processor.
Instance Method Summary collapse
-
#initialize(key:, processor: nil) ⇒ Field
constructor
A new instance of Field.
- #process(entity) ⇒ Object
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
#key ⇒ Object (readonly)
Returns the value of attribute key.
7 8 9 |
# File 'lib/magic_report/report/configuration.rb', line 7 def key @key end |
#processor ⇒ Object (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 |