| Class | Rinda::TupleBag |
| In: |
rinda/tuplespace.rb
|
| Parent: | Object |
TupleBag is an unordered collection of tuples. It is the basis of Tuplespace.
Delete tuples which dead tuples from the TupleBag, returning the deleted tuples.
# File rinda/tuplespace.rb, line 355 def delete_unless_alive deleted = [] @hash.keys.each do |size| ary = [] @hash[size].each do |tuple| if tuple.alive? ary.push(tuple) else deleted.push(tuple) end end @hash[size] = ary end deleted end
Finds a live tuple that matches template.
# File rinda/tuplespace.rb, line 335 def find(template) @hash.fetch(template.size, []).find do |tuple| tuple.alive? && template.match(tuple) end end
Finds all live tuples that match template.
# File rinda/tuplespace.rb, line 326 def find_all(template) @hash.fetch(template.size, []).find_all do |tuple| tuple.alive? && template.match(tuple) end end
ruby-doc.org is hosted and run by James Britt and Happy Camper Studios, a Ruby application development company in Phoenix, Arizona. Ruby-doc.org was created in 2002 to promote the Ruby language and to help other Ruby hackers.
Documentation content on ruby-doc.org is provided by remarkable members of the Ruby community.
For more information on the Ruby programming language, visit ruby-lang.org.
Want to help improve Ruby's API docs? See Ruby Documentation Guidelines.