Class: Blockhead::ValueExtractor
- Inherits:
-
Object
- Object
- Blockhead::ValueExtractor
- Defined in:
- lib/blockhead/value_extractor.rb
Instance Attribute Summary collapse
-
#extractor ⇒ Object
readonly
Returns the value of attribute extractor.
Instance Method Summary collapse
- #extract ⇒ Object
-
#initialize(value, *args, &block) ⇒ ValueExtractor
constructor
A new instance of ValueExtractor.
Constructor Details
#initialize(value, *args, &block) ⇒ ValueExtractor
Returns a new instance of ValueExtractor.
5 6 7 8 9 10 11 12 |
# File 'lib/blockhead/value_extractor.rb', line 5 def initialize(value, *args, &block) proc = block.to_proc if block @extractor = Extractors::Enumerable.new value, *args, proc extractors.inject(extractor) do |fallback, link| fallback.next = link.new value, *args, proc end end |
Instance Attribute Details
#extractor ⇒ Object (readonly)
Returns the value of attribute extractor.
3 4 5 |
# File 'lib/blockhead/value_extractor.rb', line 3 def extractor @extractor end |
Instance Method Details
#extract ⇒ Object
14 15 16 |
# File 'lib/blockhead/value_extractor.rb', line 14 def extract extractor.extract end |