Class: Trilogy::Result
- Inherits:
-
Object
- Object
- Trilogy::Result
- Includes:
- Enumerable
- Defined in:
- lib/trilogy/result.rb
Instance Attribute Summary collapse
-
#affected_rows ⇒ Object
readonly
Returns the value of attribute affected_rows.
-
#fields ⇒ Object
readonly
Returns the value of attribute fields.
-
#last_insert_id ⇒ Object
readonly
Returns the value of attribute last_insert_id.
-
#query_time ⇒ Object
readonly
Returns the value of attribute query_time.
-
#rows ⇒ Object
readonly
Returns the value of attribute rows.
Instance Method Summary collapse
Instance Attribute Details
#affected_rows ⇒ Object (readonly)
Returns the value of attribute affected_rows.
3 4 5 |
# File 'lib/trilogy/result.rb', line 3 def affected_rows @affected_rows end |
#fields ⇒ Object (readonly)
Returns the value of attribute fields.
3 4 5 |
# File 'lib/trilogy/result.rb', line 3 def fields @fields end |
#last_insert_id ⇒ Object (readonly)
Returns the value of attribute last_insert_id.
3 4 5 |
# File 'lib/trilogy/result.rb', line 3 def last_insert_id @last_insert_id end |
#query_time ⇒ Object (readonly)
Returns the value of attribute query_time.
3 4 5 |
# File 'lib/trilogy/result.rb', line 3 def query_time @query_time end |
#rows ⇒ Object (readonly)
Returns the value of attribute rows.
3 4 5 |
# File 'lib/trilogy/result.rb', line 3 def rows @rows end |
Instance Method Details
#count ⇒ Object
5 6 7 |
# File 'lib/trilogy/result.rb', line 5 def count rows.count end |
#each(&bk) ⇒ Object
27 28 29 |
# File 'lib/trilogy/result.rb', line 27 def each(&bk) rows.each(&bk) end |
#each_hash ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/trilogy/result.rb', line 9 def each_hash return enum_for(:each_hash) unless block_given? rows.each do |row| this_row = {} idx = 0 row.each do |col| this_row[fields[idx]] = col idx += 1 end yield this_row end self end |