Class: DatabaseRecorder::PG::RecordedResult
- Inherits:
-
Object
- Object
- DatabaseRecorder::PG::RecordedResult
- Defined in:
- lib/database_recorder/pg/recorded_result.rb
Instance Attribute Summary collapse
-
#count ⇒ Object
(also: #cmd_tuples, #ntuples)
readonly
Returns the value of attribute count.
-
#fields ⇒ Object
(also: #columns)
readonly
Returns the value of attribute fields.
-
#type_map ⇒ Object
readonly
Returns the value of attribute type_map.
-
#values ⇒ Object
(also: #rows)
readonly
Returns the value of attribute values.
Instance Method Summary collapse
- #clear ⇒ Object
- #first ⇒ Object
- #fmod(_index) ⇒ Object
- #ftype(_index) ⇒ Object
-
#initialize(data) ⇒ RecordedResult
constructor
A new instance of RecordedResult.
- #map_types!(type_map) ⇒ Object
- #nfields ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize(data) ⇒ RecordedResult
Returns a new instance of RecordedResult.
13 14 15 16 17 |
# File 'lib/database_recorder/pg/recorded_result.rb', line 13 def initialize(data) @count = data[:count] @fields = data[:fields] @values = data[:values] end |
Instance Attribute Details
#count ⇒ Object (readonly) Also known as: cmd_tuples, ntuples
Returns the value of attribute count.
6 7 8 |
# File 'lib/database_recorder/pg/recorded_result.rb', line 6 def count @count end |
#fields ⇒ Object (readonly) Also known as: columns
Returns the value of attribute fields.
6 7 8 |
# File 'lib/database_recorder/pg/recorded_result.rb', line 6 def fields @fields end |
#type_map ⇒ Object (readonly)
Returns the value of attribute type_map.
6 7 8 |
# File 'lib/database_recorder/pg/recorded_result.rb', line 6 def type_map @type_map end |
#values ⇒ Object (readonly) Also known as: rows
Returns the value of attribute values.
6 7 8 |
# File 'lib/database_recorder/pg/recorded_result.rb', line 6 def values @values end |
Instance Method Details
#clear ⇒ Object
19 |
# File 'lib/database_recorder/pg/recorded_result.rb', line 19 def clear; end |
#first ⇒ Object
21 22 23 |
# File 'lib/database_recorder/pg/recorded_result.rb', line 21 def first to_a.first end |
#fmod(_index) ⇒ Object
25 26 27 |
# File 'lib/database_recorder/pg/recorded_result.rb', line 25 def fmod(_index) -1 end |
#ftype(_index) ⇒ Object
29 30 31 |
# File 'lib/database_recorder/pg/recorded_result.rb', line 29 def ftype(_index) 20 end |
#map_types!(type_map) ⇒ Object
33 34 35 36 |
# File 'lib/database_recorder/pg/recorded_result.rb', line 33 def map_types!(type_map) @type_map = type_map self end |
#nfields ⇒ Object
38 39 40 |
# File 'lib/database_recorder/pg/recorded_result.rb', line 38 def nfields fields.size end |
#to_a ⇒ Object
42 43 44 45 46 |
# File 'lib/database_recorder/pg/recorded_result.rb', line 42 def to_a @to_a ||= values.each_with_object([]) do |value, list| list << fields.zip(value).to_h end end |