Module: Cassie::Statements::Statement::Idempotency::ClassMethods

Included in:
Cassie::Statements::Statement, Cassie::Statements::Statement::Idempotency
Defined in:
lib/cassie/statements/statement/idempotency.rb

Instance Method Summary collapse

Instance Method Details

#idempotent(val = :get) ⇒ Boolean

DSL to set a statement as idempotent


37
38
39
40
41
42
43
44
# File 'lib/cassie/statements/statement/idempotency.rb', line 37

def idempotent(val=:get)
  if val == :get
    return @idempotent if defined?(@idempotent)
    Cassie::Statements.default_idempotency
  else
    self.idempotent = val
  end
end

#idempotent=(val) ⇒ Object


30
31
32
# File 'lib/cassie/statements/statement/idempotency.rb', line 30

def idempotent=(val)
  @idempotent = val
end

#idempotent?Boolean

Indicates where the statement has no negative side-effect if issued multiple times.


55
56
57
# File 'lib/cassie/statements/statement/idempotency.rb', line 55

def idempotent?
  !!idempotent
end

#non_idempotentBoolean

DSL to set a satement as non-idempotent


48
49
50
# File 'lib/cassie/statements/statement/idempotency.rb', line 48

def non_idempotent
  self.idempotent = false
end