Class: Burner::Modeling::Attribute

Inherits:
Object
  • Object
show all
Defined in:
lib/burner/modeling/attribute.rb

Overview

Defines a top-level key and the associated transformers for deriving the final value to set the key to. The transformers that can be passed in can be any Realize::Transformers subclasses. For more information, see the Realize library at: github.com/bluemarblepayroll/realize

Note that if explicit: true is set then no transformers will be automatically injected. If explicit is not true (default) then it will have a resolve job automatically injected in the beginning of the pipeline. This is the observed default behavior, with the exception having to be initially cross-mapped using a custom resolve transformation.

Constant Summary collapse

RESOLVE_TYPE =
'r/value/resolve'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key:, explicit: false, transformers: []) ⇒ Attribute

Returns a new instance of Attribute.

Raises:

  • (ArgumentError)


28
29
30
31
32
33
34
35
# File 'lib/burner/modeling/attribute.rb', line 28

def initialize(key:, explicit: false, transformers: [])
  raise ArgumentError, 'key is required' if key.to_s.empty?

  @key          = key.to_s
  @transformers = base_transformers(explicit) + Realize::Transformers.array(transformers)

  freeze
end

Instance Attribute Details

#keyObject (readonly)

Returns the value of attribute key.



26
27
28
# File 'lib/burner/modeling/attribute.rb', line 26

def key
  @key
end

#transformersObject (readonly)

Returns the value of attribute transformers.



26
27
28
# File 'lib/burner/modeling/attribute.rb', line 26

def transformers
  @transformers
end