Class: PartitionGardener::PgConnection::Result
- Inherits:
-
Object
- Object
- PartitionGardener::PgConnection::Result
- Includes:
- Enumerable
- Defined in:
- lib/partition_gardener/pg_connection.rb
Instance Method Summary collapse
- #cmd_tuples ⇒ Object
- #each ⇒ Object
- #first ⇒ Object
-
#initialize(pg_result) ⇒ Result
constructor
A new instance of Result.
- #to_a ⇒ Object
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_tuples ⇒ Object
22 23 24 |
# File 'lib/partition_gardener/pg_connection.rb', line 22 def cmd_tuples @pg_result.cmd_tuples end |
#each ⇒ Object
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 |
#first ⇒ Object
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_a ⇒ Object
18 19 20 |
# File 'lib/partition_gardener/pg_connection.rb', line 18 def to_a @pg_result.to_a end |