Class: Herder::Model::Query

Inherits:
Object
  • Object
show all
Defined in:
lib/herder/model/query.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(model) ⇒ Query

Returns a new instance of Query.



6
7
8
9
# File 'lib/herder/model/query.rb', line 6

def initialize model
  self.model = model
  self.params = {}
end

Instance Attribute Details

#modelObject

Returns the value of attribute model.



4
5
6
# File 'lib/herder/model/query.rb', line 4

def model
  @model
end

#paramsObject

Returns the value of attribute params.



4
5
6
# File 'lib/herder/model/query.rb', line 4

def params
  @params
end

Instance Method Details

#each(&block) ⇒ Object



16
17
18
# File 'lib/herder/model/query.rb', line 16

def each &block
  query.each &block
end

#to_sObject



20
21
22
# File 'lib/herder/model/query.rb', line 20

def to_s
  query.to_s
end

#where(*prms) ⇒ Object



11
12
13
14
# File 'lib/herder/model/query.rb', line 11

def where *prms
  params.merge!(sanitize prms)
  self
end