Class: Blockhead::Extractors::Abstract
- Inherits:
-
Object
- Object
- Blockhead::Extractors::Abstract
- Defined in:
- lib/blockhead/extractors/abstract.rb
Direct Known Subclasses
Block, Enumerable, Proc, Value
Instance Attribute Summary collapse
-
#next ⇒ Object
writeonly
Sets the attribute next.
-
#object ⇒ Object
readonly
Returns the value of attribute object.
Instance Method Summary collapse
- #extract ⇒ Object
- #extract_value ⇒ Object
-
#initialize(object, arg, proc) ⇒ Abstract
constructor
A new instance of Abstract.
- #valid? ⇒ Boolean
Constructor Details
#initialize(object, arg, proc) ⇒ Abstract
Returns a new instance of Abstract.
7 8 9 10 11 |
# File 'lib/blockhead/extractors/abstract.rb', line 7 def initialize(object, arg, proc) @object = object @arg = arg @proc = proc end |
Instance Attribute Details
#next=(value) ⇒ Object (writeonly)
Sets the attribute next
4 5 6 |
# File 'lib/blockhead/extractors/abstract.rb', line 4 def next=(value) @next = value end |
#object ⇒ Object (readonly)
Returns the value of attribute object.
5 6 7 |
# File 'lib/blockhead/extractors/abstract.rb', line 5 def object @object end |
Instance Method Details
#extract ⇒ Object
21 22 23 24 25 26 27 |
# File 'lib/blockhead/extractors/abstract.rb', line 21 def extract if valid? extract_value else @next.extract end end |
#extract_value ⇒ Object
17 18 19 |
# File 'lib/blockhead/extractors/abstract.rb', line 17 def extract_value fail '#extract_value not implemented' end |
#valid? ⇒ Boolean
13 14 15 |
# File 'lib/blockhead/extractors/abstract.rb', line 13 def valid? fail '#valid? not implemented' end |