Class: Dynamoid::Criteria::WhereConditions

Inherits:
Object
  • Object
show all
Defined in:
lib/dynamoid/criteria/where_conditions.rb

Instance Method Summary collapse

Constructor Details

#initializeWhereConditions

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

Returns:

  • (Boolean)


19
20
21
# File 'lib/dynamoid/criteria/where_conditions.rb', line 19

def empty?
  @conditions.empty?
end

#keysObject



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