Class: DynamoidAdvancedWhere::Nodes::LiteralNode

Inherits:
Object
  • Object
show all
Defined in:
lib/dynamoid_advanced_where/nodes/literal_node.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(value) ⇒ LiteralNode

Returns a new instance of LiteralNode.



10
11
12
13
14
# File 'lib/dynamoid_advanced_where/nodes/literal_node.rb', line 10

def initialize(value)
  self.value = value
  self.attr_prefix = SecureRandom.hex
  freeze
end

Instance Attribute Details

#attr_prefixObject

Returns the value of attribute attr_prefix.



8
9
10
# File 'lib/dynamoid_advanced_where/nodes/literal_node.rb', line 8

def attr_prefix
  @attr_prefix
end

#valueObject

Returns the value of attribute value.



8
9
10
# File 'lib/dynamoid_advanced_where/nodes/literal_node.rb', line 8

def value
  @value
end

Instance Method Details

#expression_attribute_namesObject



20
21
22
# File 'lib/dynamoid_advanced_where/nodes/literal_node.rb', line 20

def expression_attribute_names
  {}
end

#expression_attribute_valuesObject



24
25
26
# File 'lib/dynamoid_advanced_where/nodes/literal_node.rb', line 24

def expression_attribute_values
  { ":#{attr_prefix}" => value }
end

#to_expressionObject



16
17
18
# File 'lib/dynamoid_advanced_where/nodes/literal_node.rb', line 16

def to_expression
  ":#{attr_prefix}"
end