Class: BatchAny::Item
- Inherits:
-
Object
- Object
- BatchAny::Item
- Defined in:
- lib/batch_any/item.rb
Instance Attribute Summary collapse
-
#exception ⇒ Object
Returns the value of attribute exception.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
Instance Attribute Details
#exception ⇒ Object
Returns the value of attribute exception.
3 4 5 |
# File 'lib/batch_any/item.rb', line 3 def exception @exception end |
#value ⇒ Object
Returns the value of attribute value.
3 4 5 |
# File 'lib/batch_any/item.rb', line 3 def value @value end |
Instance Method Details
#fetch ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/batch_any/item.rb', line 9 def fetch batching_manager = Thread.current[:batch_any_manager] if batching_manager batching_manager.enqueue_item(self) else service_class.new(self).fetch end raise @exception if @exception @value end |
#result ⇒ Object
20 21 22 23 24 |
# File 'lib/batch_any/item.rb', line 20 def result @value = yield rescue => e @exception = e end |
#service_class ⇒ Object
5 6 7 |
# File 'lib/batch_any/item.rb', line 5 def service_class raise "Not implemented: #{self.class}#service_class -> Class, required by BatchAny::Item" end |