Parent

Included Modules

Class/Module Index [+]

Quicksearch

Ruote::HashParticipant

Storing workitems in-memory. Mainly used for testing purposes, but could prove useful for a transient ruote engine.

Public Class Methods

new(opts=nil) click to toggle source
# File lib/ruote/part/hash_participant.rb, line 39
def initialize (opts=nil)

  @items = {}
end

Public Instance Methods

cancel(fei, flavour) click to toggle source

Makes sure to remove the workitem from the in-memory hash.

# File lib/ruote/part/hash_participant.rb, line 55
def cancel (fei, flavour)

  @items.delete(fei.to_storage_id)
end
consume(workitem) click to toggle source
# File lib/ruote/part/hash_participant.rb, line 48
def consume (workitem)

  @items[workitem.fei.to_storage_id] = workitem
end
do_not_thread() click to toggle source

No need for a separate thread when delivering to this participant.

# File lib/ruote/part/hash_participant.rb, line 46
def do_not_thread; true; end
each(&block) click to toggle source

Iterates over the workitems stored in here.

# File lib/ruote/part/hash_participant.rb, line 77
def each (&block)

  @items.each { |i| block.call(i) }
end
first() click to toggle source

A convenience method (especially when testing), returns the first (only ?) workitem in the participant.

# File lib/ruote/part/hash_participant.rb, line 85
def first

  @items.values.first
end
reply(workitem) click to toggle source

Removes the workitem from the in-memory hash and replies to the engine.

# File lib/ruote/part/hash_participant.rb, line 62
def reply (workitem)

  @items.delete(workitem.fei.to_storage_id)
  reply_to_engine(workitem)
end
size() click to toggle source

Returns the count of workitems stored in this participant.

# File lib/ruote/part/hash_participant.rb, line 70
def size

  @items.size
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.