Class: Tresse::Batch
- Inherits:
-
Object
- Object
- Tresse::Batch
- Defined in:
- lib/tresse.rb
Instance Attribute Summary collapse
-
#completed ⇒ Object
readonly
Returns the value of attribute completed.
-
#error ⇒ Object
Returns the value of attribute error.
-
#group ⇒ Object
readonly
Returns the value of attribute group.
-
#map_index ⇒ Object
readonly
Returns the value of attribute map_index.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
- #complete ⇒ Object
-
#initialize(group, block_or_group) ⇒ Batch
constructor
A new instance of Batch.
- #map(type, block) ⇒ Object
- #process ⇒ Object
- #source ⇒ Object
Constructor Details
#initialize(group, block_or_group) ⇒ Batch
Returns a new instance of Batch.
86 87 88 89 90 91 92 93 94 |
# File 'lib/tresse.rb', line 86 def initialize(group, block_or_group) @group = group @bog = block_or_group @map_index = -1 @value = nil @completed = false end |
Instance Attribute Details
#completed ⇒ Object (readonly)
Returns the value of attribute completed.
82 83 84 |
# File 'lib/tresse.rb', line 82 def completed @completed end |
#error ⇒ Object
Returns the value of attribute error.
84 85 86 |
# File 'lib/tresse.rb', line 84 def error @error end |
#group ⇒ Object (readonly)
Returns the value of attribute group.
80 81 82 |
# File 'lib/tresse.rb', line 80 def group @group end |
#map_index ⇒ Object (readonly)
Returns the value of attribute map_index.
81 82 83 |
# File 'lib/tresse.rb', line 81 def map_index @map_index end |
#value ⇒ Object
Returns the value of attribute value.
83 84 85 |
# File 'lib/tresse.rb', line 83 def value @value end |
Instance Method Details
#complete ⇒ Object
114 115 116 117 |
# File 'lib/tresse.rb', line 114 def complete @completed = true end |
#map(type, block) ⇒ Object
107 108 109 110 111 112 |
# File 'lib/tresse.rb', line 107 def map(type, block) r = Tresse.call_block(block, [ @value, self ]) @value = r if type == :map end |
#process ⇒ Object
96 97 98 99 100 |
# File 'lib/tresse.rb', line 96 def process @map_index += 1 @group.send(:receive, self) end |
#source ⇒ Object
102 103 104 105 |
# File 'lib/tresse.rb', line 102 def source @value = Tresse.call_block(@bog, [ group ] + [ nil ] * 7) end |