Class: Rufus::Edo::TableResultSet
- Inherits:
-
Object
- Object
- Rufus::Edo::TableResultSet
- Includes:
- Enumerable
- Defined in:
- lib/rufus/edo/tabcore.rb
Overview
The thing queries return
Instance Method Summary collapse
-
#each ⇒ Object
The classical each.
-
#free ⇒ Object
(also: #close, #destroy)
Frees this query (the underlying Tokyo Cabinet list structure).
-
#initialize(table, primary_keys, query_opts) ⇒ TableResultSet
constructor
A new instance of TableResultSet.
-
#size ⇒ Object
(also: #length)
Returns the count of element in this result set.
-
#to_a ⇒ Object
Returns an array of hashes.
Constructor Details
#initialize(table, primary_keys, query_opts) ⇒ TableResultSet
Returns a new instance of TableResultSet.
657 658 659 660 661 662 |
# File 'lib/rufus/edo/tabcore.rb', line 657 def initialize (table, primary_keys, query_opts) @table = table @keys = primary_keys @opts = query_opts end |
Instance Method Details
#each ⇒ Object
The classical each
675 676 677 678 679 680 681 682 683 684 685 686 |
# File 'lib/rufus/edo/tabcore.rb', line 675 def each @keys.each do |pk| if @opts[:pk_only] yield(pk) else val = @table[pk] val[:pk] = pk unless @opts[:no_pk] yield(val) end end end |
#free ⇒ Object Also known as: close, destroy
Frees this query (the underlying Tokyo Cabinet list structure)
697 698 699 700 |
# File 'lib/rufus/edo/tabcore.rb', line 697 def free # nothing to do, kept for similarity with Rufus::Tokyo end |
#size ⇒ Object Also known as: length
Returns the count of element in this result set
666 667 668 669 |
# File 'lib/rufus/edo/tabcore.rb', line 666 def size @keys.size end |
#to_a ⇒ Object
Returns an array of hashes
690 691 692 693 |
# File 'lib/rufus/edo/tabcore.rb', line 690 def to_a self.collect { |m| m } end |