class BatchAny::Item

Attributes

exception[RW]
value[RW]

Public Instance Methods

fetch() click to toggle source
# 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() { || ... } click to toggle source
# File lib/batch_any/item.rb, line 20
def result
  @value = yield
rescue => e
  @exception = e
end
service_class() click to toggle source
# File lib/batch_any/item.rb, line 5
def service_class
  raise "Not implemented: #{self.class}#service_class -> Class, required by BatchAny::Item"
end