Class: QueryResult
- Inherits:
-
Object
- Object
- QueryResult
- Includes:
- Enumerable
- Defined in:
- lib/good_times/query_result.rb
Instance Attribute Summary collapse
-
#offset ⇒ Object
readonly
Returns the value of attribute offset.
-
#rows ⇒ Object
readonly
Returns the value of attribute rows.
-
#total_rows ⇒ Object
readonly
Returns the value of attribute total_rows.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(results) ⇒ QueryResult
constructor
A new instance of QueryResult.
Constructor Details
#initialize(results) ⇒ QueryResult
6 7 8 9 10 |
# File 'lib/good_times/query_result.rb', line 6 def initialize(results) results.each do |key, value| instance_variable_set("@#{key.to_s}", value) end end |
Instance Attribute Details
#offset ⇒ Object (readonly)
Returns the value of attribute offset.
4 5 6 |
# File 'lib/good_times/query_result.rb', line 4 def offset @offset end |
#rows ⇒ Object (readonly)
Returns the value of attribute rows.
4 5 6 |
# File 'lib/good_times/query_result.rb', line 4 def rows @rows end |
#total_rows ⇒ Object (readonly)
Returns the value of attribute total_rows.
4 5 6 |
# File 'lib/good_times/query_result.rb', line 4 def total_rows @total_rows end |
Instance Method Details
#each(&block) ⇒ Object
12 13 14 |
# File 'lib/good_times/query_result.rb', line 12 def each(&block) @rows.each {|row| block.call(row)} end |