Class: QueryResult

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/good_times/query_result.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#offsetObject (readonly)

Returns the value of attribute offset.



4
5
6
# File 'lib/good_times/query_result.rb', line 4

def offset
  @offset
end

#rowsObject (readonly)

Returns the value of attribute rows.



4
5
6
# File 'lib/good_times/query_result.rb', line 4

def rows
  @rows
end

#total_rowsObject (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