Class: DynamoidAdvancedWhere::Nodes::AndNode
- Includes:
- Concerns::Negatable
- Defined in:
- lib/dynamoid_advanced_where/nodes/and_node.rb
Instance Attribute Summary collapse
-
#child_nodes ⇒ Object
Returns the value of attribute child_nodes.
Attributes inherited from BaseNode
Instance Method Summary collapse
- #and(other_value) ⇒ Object (also: #&)
- #expression_attribute_names ⇒ Object
- #expression_attribute_values ⇒ Object
-
#initialize(*child_nodes) ⇒ AndNode
constructor
A new instance of AndNode.
- #to_expression ⇒ Object
Methods included from Concerns::Negatable
Constructor Details
#initialize(*child_nodes) ⇒ AndNode
Returns a new instance of AndNode.
21 22 23 24 |
# File 'lib/dynamoid_advanced_where/nodes/and_node.rb', line 21 def initialize(*child_nodes) self.child_nodes = child_nodes.freeze freeze end |
Instance Attribute Details
#child_nodes ⇒ Object
Returns the value of attribute child_nodes.
19 20 21 |
# File 'lib/dynamoid_advanced_where/nodes/and_node.rb', line 19 def child_nodes @child_nodes end |
Instance Method Details
#and(other_value) ⇒ Object Also known as: &
40 41 42 |
# File 'lib/dynamoid_advanced_where/nodes/and_node.rb', line 40 def and(other_value) AndNode.new(other_value, *child_nodes) end |
#expression_attribute_names ⇒ Object
32 33 34 |
# File 'lib/dynamoid_advanced_where/nodes/and_node.rb', line 32 def expression_attribute_names child_nodes.map(&:expression_attribute_names).inject({}, &:merge!) end |
#expression_attribute_values ⇒ Object
36 37 38 |
# File 'lib/dynamoid_advanced_where/nodes/and_node.rb', line 36 def expression_attribute_values child_nodes.map(&:expression_attribute_values).inject({}, &:merge!) end |
#to_expression ⇒ Object
26 27 28 29 30 |
# File 'lib/dynamoid_advanced_where/nodes/and_node.rb', line 26 def to_expression return if child_nodes.empty? "(#{child_nodes.map(&:to_expression).join(') and (')})" end |