Class: PartitionGardener::PgConnection::Result

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/partition_gardener/pg_connection.rb

Instance Method Summary collapse

Constructor Details

#initialize(pg_result) ⇒ Result

Returns a new instance of Result.



8
9
10
# File 'lib/partition_gardener/pg_connection.rb', line 8

def initialize(pg_result)
  @pg_result = pg_result
end

Instance Method Details

#cmd_tuplesObject



22
23
24
# File 'lib/partition_gardener/pg_connection.rb', line 22

def cmd_tuples
  @pg_result.cmd_tuples
end

#eachObject



26
27
28
29
30
# File 'lib/partition_gardener/pg_connection.rb', line 26

def each
  return enum_for(:each) unless block_given?

  @pg_result.each { |row| yield row }
end

#firstObject



12
13
14
15
16
# File 'lib/partition_gardener/pg_connection.rb', line 12

def first
  return nil if @pg_result.ntuples.zero?

  @pg_result[0]
end

#to_aObject



18
19
20
# File 'lib/partition_gardener/pg_connection.rb', line 18

def to_a
  @pg_result.to_a
end