Class: IntegratedData::Entity::Lookup
- Inherits:
-
Struct
- Object
- Struct
- IntegratedData::Entity::Lookup
- Defined in:
- lib/integrated_data/entity/lookup.rb,
lib/integrated_data/entity/lookup.rb
Defined Under Namespace
Classes: Error
Instance Attribute Summary collapse
-
#attribute ⇒ Object
Returns the value of attribute attribute.
-
#extractor ⇒ Object
Returns the value of attribute extractor.
-
#id ⇒ Object
Returns the value of attribute id.
-
#identifier ⇒ Object
Returns the value of attribute identifier.
-
#options ⇒ Object
Returns the value of attribute options.
-
#source ⇒ Object
Returns the value of attribute source.
-
#strategy ⇒ Object
Returns the value of attribute strategy.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#attribute ⇒ Object
Returns the value of attribute attribute
3 4 5 |
# File 'lib/integrated_data/entity/lookup.rb', line 3 def attribute @attribute end |
#extractor ⇒ Object
Returns the value of attribute extractor
3 4 5 |
# File 'lib/integrated_data/entity/lookup.rb', line 3 def extractor @extractor end |
#id ⇒ Object
Returns the value of attribute id
3 4 5 |
# File 'lib/integrated_data/entity/lookup.rb', line 3 def id @id end |
#identifier ⇒ Object
Returns the value of attribute identifier
3 4 5 |
# File 'lib/integrated_data/entity/lookup.rb', line 3 def identifier @identifier end |
#options ⇒ Object
Returns the value of attribute options
3 4 5 |
# File 'lib/integrated_data/entity/lookup.rb', line 3 def end |
#source ⇒ Object
Returns the value of attribute source
3 4 5 |
# File 'lib/integrated_data/entity/lookup.rb', line 3 def source @source end |
#strategy ⇒ Object
Returns the value of attribute strategy
3 4 5 |
# File 'lib/integrated_data/entity/lookup.rb', line 3 def strategy @strategy end |
Class Method Details
.cache_keys ⇒ Object
7 8 9 |
# File 'lib/integrated_data/entity/lookup.rb', line 7 def cache_keys [:identifier, :source, :strategy, :extractor, :options] end |
Instance Method Details
#cache_keys ⇒ Object
12 13 14 15 16 |
# File 'lib/integrated_data/entity/lookup.rb', line 12 def cache_keys self.class.cache_keys.map do |key| send key end end |
#extract(data, attribute) ⇒ Object
22 23 24 25 26 27 28 |
# File 'lib/integrated_data/entity/lookup.rb', line 22 def extract(data, attribute) if extractor extractor.call data, attribute else default_extractor data, attribute end end |
#perform(value) ⇒ Object
18 19 20 |
# File 'lib/integrated_data/entity/lookup.rb', line 18 def perform(value) source.build().public_send(strategy, id, prepare(value)) end |