Module: Cassie::Statements::Statement::Conditions::ClassMethods

Included in:
Deleting, Inserting, Updating
Defined in:
lib/cassie/statements/statement/conditions.rb

Instance Method Summary collapse

Instance Method Details

#conditionsObject



24
25
26
# File 'lib/cassie/statements/statement/conditions.rb', line 24

def conditions
  @conditions ||= {}
end

#if_exists(opts = {}) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/cassie/statements/statement/conditions.rb', line 16

def if_exists(opts={})
  condition = "EXISTS"
  opts.delete(:value)
  opts[:if] = true unless opts.has_key?(:if)

  conditions[condition] = opts
end

#if_not_exists(opts = {}) ⇒ Object



8
9
10
11
12
13
14
# File 'lib/cassie/statements/statement/conditions.rb', line 8

def if_not_exists(opts={})
  condition = "NOT EXISTS"
  opts.delete(:value)
  opts[:if] = true unless opts.has_key?(:if)

  conditions[condition] = opts
end