Class: YADM::Query
Instance Attribute Summary collapse
-
#arguments ⇒ Object
readonly
Returns the value of attribute arguments.
-
#criteria ⇒ Object
readonly
Returns the value of attribute criteria.
Instance Method Summary collapse
- #each(&block) ⇒ Object
-
#initialize(criteria = Criteria.new, arguments = {}) ⇒ Query
constructor
A new instance of Query.
- #merge(new_criteria, new_arguments) ⇒ Object
- #repository ⇒ Object
- #to_a ⇒ Object
Constructor Details
#initialize(criteria = Criteria.new, arguments = {}) ⇒ Query
Returns a new instance of Query.
7 8 9 10 |
# File 'lib/yadm/query.rb', line 7 def initialize(criteria = Criteria.new, arguments = {}) @criteria = criteria @arguments = arguments end |
Instance Attribute Details
#arguments ⇒ Object (readonly)
Returns the value of attribute arguments.
3 4 5 |
# File 'lib/yadm/query.rb', line 3 def arguments @arguments end |
#criteria ⇒ Object (readonly)
Returns the value of attribute criteria.
3 4 5 |
# File 'lib/yadm/query.rb', line 3 def criteria @criteria end |
Instance Method Details
#each(&block) ⇒ Object
20 21 22 |
# File 'lib/yadm/query.rb', line 20 def each(&block) to_a.each(&block) end |
#merge(new_criteria, new_arguments) ⇒ Object
12 13 14 |
# File 'lib/yadm/query.rb', line 12 def merge(new_criteria, new_arguments) self.class.new(criteria.merge(new_criteria), arguments.merge(new_arguments)) end |
#repository ⇒ Object
24 25 26 |
# File 'lib/yadm/query.rb', line 24 def repository raise NotImplementedError end |
#to_a ⇒ Object
16 17 18 |
# File 'lib/yadm/query.rb', line 16 def to_a repository.send_query(self) end |