Class: Rufus::Edo::TableResultSet

Included Modules

Enumerable

The thing queries return

Constructor Summary

public initialize(table, primary_keys, query_opts)
[View source]


666
667
668
669
670
671
# File 'lib/rufus/edo/tabcore.rb', line 666

def initialize (table, primary_keys, query_opts)

  @table = table
  @keys = primary_keys
  @opts = query_opts
end

Public Visibility

Public Instance Method Summary

#each

The classical each.

#free #close #destroy

Frees this query (the underlying Tokyo Cabinet list structure).

#size #length

Returns the count of element in this result set.

#to_a

Returns an array of hashes.

Public Instance Method Details

each

public each

The classical each

[View source]


684
685
686
687
688
689
690
691
692
693
694
695
# File 'lib/rufus/edo/tabcore.rb', line 684

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

public free

Also known as: close destroy

Frees this query (the underlying Tokyo Cabinet list structure)

[View source]


706
707
708
709
# File 'lib/rufus/edo/tabcore.rb', line 706

def free

  # nothing to do, kept for similarity with Rufus::Tokyo
end

size

public size

Also known as: length

Returns the count of element in this result set

[View source]


675
676
677
678
# File 'lib/rufus/edo/tabcore.rb', line 675

def size

  @keys.size
end

to_a

public to_a

Returns an array of hashes

[View source]


699
700
701
702
# File 'lib/rufus/edo/tabcore.rb', line 699

def to_a

  self.collect { |m| m }
end
Generated on Friday, September 18 2009 at 10:35:44 AM by YARD 0.2.3.5 (ruby-1.8.7).