Class: ROM::DynamoDB::Dataset::WhereClause

Inherits:
Object
  • Object
show all
Defined in:
lib/rom/dynamodb/dataset/where_clause.rb

Defined Under Namespace

Classes: Clause, Operand

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(maps = {}) ⇒ WhereClause

Returns a new instance of WhereClause.



84
85
86
87
# File 'lib/rom/dynamodb/dataset/where_clause.rb', line 84

def initialize(maps = {})
  @clauses = Clause.new
  @maps = maps
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(key) ⇒ Object



94
95
96
# File 'lib/rom/dynamodb/dataset/where_clause.rb', line 94

def method_missing(key)
  Operand.new(key: key, val: maps[key])
end

Instance Attribute Details

#clausesObject (readonly)

Returns the value of attribute clauses.



82
83
84
# File 'lib/rom/dynamodb/dataset/where_clause.rb', line 82

def clauses
  @clauses
end

#mapsObject (readonly)

Returns the value of attribute maps.



82
83
84
# File 'lib/rom/dynamodb/dataset/where_clause.rb', line 82

def maps
  @maps
end

Instance Method Details

#execute(&block) ⇒ Object



89
90
91
92
# File 'lib/rom/dynamodb/dataset/where_clause.rb', line 89

def execute(&block)
  @clauses.concat(instance_exec(&block))
  self
end