Class: Dynamoid::Criteria::WhereConditions
- Inherits:
-
Object
- Object
- Dynamoid::Criteria::WhereConditions
- Defined in:
- lib/dynamoid/criteria/where_conditions.rb
Instance Method Summary collapse
- #[](key) ⇒ Object
- #empty? ⇒ Boolean
-
#initialize ⇒ WhereConditions
constructor
A new instance of WhereConditions.
- #keys ⇒ Object
- #update(hash) ⇒ Object
Constructor Details
#initialize ⇒ WhereConditions
Returns a new instance of WhereConditions.
7 8 9 |
# File 'lib/dynamoid/criteria/where_conditions.rb', line 7 def initialize @conditions = [] end |
Instance Method Details
#[](key) ⇒ Object
23 24 25 26 |
# File 'lib/dynamoid/criteria/where_conditions.rb', line 23 def [](key) hash = @conditions.find { |h| h.key?(key) } hash[key] if hash end |
#empty? ⇒ Boolean
19 20 21 |
# File 'lib/dynamoid/criteria/where_conditions.rb', line 19 def empty? @conditions.empty? end |
#keys ⇒ Object
15 16 17 |
# File 'lib/dynamoid/criteria/where_conditions.rb', line 15 def keys @conditions.flat_map(&:keys) end |
#update(hash) ⇒ Object
11 12 13 |
# File 'lib/dynamoid/criteria/where_conditions.rb', line 11 def update(hash) @conditions << hash.symbolize_keys end |