Class: Blockhead::ValueExtractor

Inherits:
Object
  • Object
show all
Extended by:
Forwardable
Defined in:
lib/blockhead/value_extractor.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value, arg, &block) ⇒ ValueExtractor

Returns a new instance of ValueExtractor.



8
9
10
11
12
13
14
15
16
# File 'lib/blockhead/value_extractor.rb', line 8

def initialize(value, arg, &block)
  proc = block.to_proc if block

  @extractor = Extractors::Enumerable.new value, arg, proc

  extractors.inject(extractor) do |fallback, link|
    fallback.next = link.new value, arg, proc
  end
end

Instance Attribute Details

#extractorObject (readonly)

Returns the value of attribute extractor.



6
7
8
# File 'lib/blockhead/value_extractor.rb', line 6

def extractor
  @extractor
end