Class: JSONORM::ChainableQuery
- Inherits:
-
Object
- Object
- JSONORM::ChainableQuery
- Defined in:
- lib/json-orm/chainable-query.rb
Instance Method Summary collapse
- #execute ⇒ Object
-
#initialize(orm, data) ⇒ ChainableQuery
constructor
A new instance of ChainableQuery.
- #where(attribute, value) ⇒ Object
Constructor Details
#initialize(orm, data) ⇒ ChainableQuery
Returns a new instance of ChainableQuery.
5 6 7 8 |
# File 'lib/json-orm/chainable-query.rb', line 5 def initialize(orm, data) @orm = orm @data = data end |
Instance Method Details
#execute ⇒ Object
15 16 17 |
# File 'lib/json-orm/chainable-query.rb', line 15 def execute @data end |
#where(attribute, value) ⇒ Object
10 11 12 13 |
# File 'lib/json-orm/chainable-query.rb', line 10 def where(attribute, value) @data = @data.select { |record| record[attribute].to_s == value.to_s } self end |