Class: DynamoidAdvancedWhere::Nodes::OperationNode

Inherits:
BaseNode
  • Object
show all
Includes:
Concerns::Negatable, Concerns::SupportsLogicalAnd, Concerns::SupportsLogicalOr
Defined in:
lib/dynamoid_advanced_where/nodes/operation_node.rb

Class Attribute Summary collapse

Instance Attribute Summary collapse

Attributes inherited from BaseNode

#expression_prefix

Instance Method Summary collapse

Methods included from Concerns::SupportsLogicalOr

#or

Methods included from Concerns::SupportsLogicalAnd

#and

Methods included from Concerns::Negatable

#negate

Constructor Details

#initialize(lh_operation:, rh_operation:) ⇒ OperationNode

Returns a new instance of OperationNode.



20
21
22
23
24
# File 'lib/dynamoid_advanced_where/nodes/operation_node.rb', line 20

def initialize(lh_operation:, rh_operation:)
  self.lh_operation = lh_operation
  self.rh_operation = rh_operation
  freeze
end

Class Attribute Details

.operatorObject

Returns the value of attribute operator.



15
16
17
# File 'lib/dynamoid_advanced_where/nodes/operation_node.rb', line 15

def operator
  @operator
end

Instance Attribute Details

#lh_operationObject

Returns the value of attribute lh_operation.



18
19
20
# File 'lib/dynamoid_advanced_where/nodes/operation_node.rb', line 18

def lh_operation
  @lh_operation
end

#rh_operationObject

Returns the value of attribute rh_operation.



18
19
20
# File 'lib/dynamoid_advanced_where/nodes/operation_node.rb', line 18

def rh_operation
  @rh_operation
end

Instance Method Details

#expression_attribute_namesObject



31
32
33
34
35
# File 'lib/dynamoid_advanced_where/nodes/operation_node.rb', line 31

def expression_attribute_names
  lh_operation.expression_attribute_names.merge(
    rh_operation.expression_attribute_names
  )
end

#expression_attribute_valuesObject



37
38
39
40
41
# File 'lib/dynamoid_advanced_where/nodes/operation_node.rb', line 37

def expression_attribute_values
  lh_operation.expression_attribute_values.merge(
    rh_operation.expression_attribute_values
  )
end

#to_expressionObject



26
27
28
29
# File 'lib/dynamoid_advanced_where/nodes/operation_node.rb', line 26

def to_expression
  "#{lh_operation.to_expression} #{self.class.operator} " \
    "#{rh_operation.to_expression} "
end