Class: Dynamoid::Criteria::Chain
- Inherits:
-
Object
- Object
- Dynamoid::Criteria::Chain
- Includes:
- Enumerable
- Defined in:
- lib/dynamoid/criteria/chain.rb
Overview
The class object that gets passed around indicating state of a building query. Also provides query execution.
Instance Attribute Summary collapse
-
#index ⇒ Object
writeonly
Sets the attribute index.
-
#query ⇒ Object
Returns the value of attribute query.
-
#source ⇒ Object
Returns the value of attribute source.
-
#values ⇒ Object
Returns the value of attribute values.
Instance Method Summary collapse
- #all ⇒ Object
- #each(&block) ⇒ Object
- #first ⇒ Object
-
#initialize(source) ⇒ Chain
constructor
A new instance of Chain.
- #where(args) ⇒ Object
Constructor Details
#initialize(source) ⇒ Chain
Returns a new instance of Chain.
11 12 13 14 |
# File 'lib/dynamoid/criteria/chain.rb', line 11 def initialize(source) @query = {} @source = source end |
Instance Attribute Details
#index=(value) ⇒ Object
Sets the attribute index
8 9 10 |
# File 'lib/dynamoid/criteria/chain.rb', line 8 def index=(value) @index = value end |
#query ⇒ Object
Returns the value of attribute query.
8 9 10 |
# File 'lib/dynamoid/criteria/chain.rb', line 8 def query @query end |
#source ⇒ Object
Returns the value of attribute source.
8 9 10 |
# File 'lib/dynamoid/criteria/chain.rb', line 8 def source @source end |
#values ⇒ Object
Returns the value of attribute values.
8 9 10 |
# File 'lib/dynamoid/criteria/chain.rb', line 8 def values @values end |
Instance Method Details
#all ⇒ Object
21 22 23 |
# File 'lib/dynamoid/criteria/chain.rb', line 21 def all records end |
#each(&block) ⇒ Object
29 30 31 |
# File 'lib/dynamoid/criteria/chain.rb', line 29 def each(&block) records.each(&block) end |
#first ⇒ Object
25 26 27 |
# File 'lib/dynamoid/criteria/chain.rb', line 25 def first records.first end |
#where(args) ⇒ Object
16 17 18 19 |
# File 'lib/dynamoid/criteria/chain.rb', line 16 def where(args) args.each {|k, v| query[k] = v} self end |