Class: Cql::Model::Query::UpdateExpression

Inherits:
Expression
  • Object
show all
Defined in:
lib/cql/model/query/update_expression.rb

Constant Summary collapse

OPERATORS =

Operators allowed in an update lambda

{
  :+   => '+',
  :-   => '-',
  :[]= => true # special treatment in #__build__
}.freeze

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ UpdateExpression

Returns a new instance of UpdateExpression.



14
15
16
17
18
19
20
# File 'lib/cql/model/query/update_expression.rb', line 14

def initialize(&block)
  @left     = nil
  @operator = nil
  @right    = nil

  instance_exec(&block) if block
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(token, *args) ⇒ Object



41
42
43
# File 'lib/cql/model/query/update_expression.rb', line 41

def method_missing(token, *args)
  __apply__(token, args)
end

Instance Method Details

#inspectObject



28
29
30
# File 'lib/cql/model/query/update_expression.rb', line 28

def inspect
  __build__
end

#to_sObject



23
24
25
# File 'lib/cql/model/query/update_expression.rb', line 23

def to_s
  __build__
end