Class: RgGen::Core::InputBase::InputValueExtractor
- Defined in:
- lib/rggen/core/input_base/input_value_extractor.rb
Class Attribute Summary collapse
-
.extractor ⇒ Object
readonly
Returns the value of attribute extractor.
Instance Method Summary collapse
- #extract(input_data) ⇒ Object
-
#initialize(target_layers, target_value) ⇒ InputValueExtractor
constructor
A new instance of InputValueExtractor.
- #target_value?(layer, value) ⇒ Boolean
Constructor Details
#initialize(target_layers, target_value) ⇒ InputValueExtractor
Returns a new instance of InputValueExtractor.
7 8 9 10 |
# File 'lib/rggen/core/input_base/input_value_extractor.rb', line 7 def initialize(target_layers, target_value) @target_layers = Array(target_layers) @target_value = target_value end |
Class Attribute Details
.extractor ⇒ Object (readonly)
Returns the value of attribute extractor.
13 14 15 |
# File 'lib/rggen/core/input_base/input_value_extractor.rb', line 13 def extractor @extractor end |
Instance Method Details
#extract(input_data) ⇒ Object
27 28 29 30 |
# File 'lib/rggen/core/input_base/input_value_extractor.rb', line 27 def extract(input_data) body = self.class.extractor instance_exec(input_data, &body) end |
#target_value?(layer, value) ⇒ Boolean
22 23 24 25 |
# File 'lib/rggen/core/input_base/input_value_extractor.rb', line 22 def target_value?(layer, value) value == @target_value && (@target_layers.empty? || @target_layers.include?(layer)) end |