Class: DynamoidAdvancedWhere::Nodes::RootNode
- Extended by:
- Forwardable
- Defined in:
- lib/dynamoid_advanced_where/nodes/root_node.rb
Instance Attribute Summary collapse
-
#child_node ⇒ Object
Returns the value of attribute child_node.
-
#klass ⇒ Object
Returns the value of attribute klass.
Attributes inherited from BaseNode
Instance Method Summary collapse
- #allowed_field?(method) ⇒ Boolean
-
#initialize(klass:, &blk) ⇒ RootNode
constructor
A new instance of RootNode.
- #method_missing(method, *args, &blk) ⇒ Object
- #respond_to_missing?(method, _i) ⇒ Boolean
Methods inherited from BaseNode
#expression_attribute_names, #expression_attribute_values
Constructor Details
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &blk) ⇒ Object
19 20 21 22 23 24 25 |
# File 'lib/dynamoid_advanced_where/nodes/root_node.rb', line 19 def method_missing(method, *args, &blk) if allowed_field?(method) FieldNode.create_node(attr_config: klass.attributes[method], field_path: method) else super end end |
Instance Attribute Details
#child_node ⇒ Object
Returns the value of attribute child_node.
10 11 12 |
# File 'lib/dynamoid_advanced_where/nodes/root_node.rb', line 10 def child_node @child_node end |
#klass ⇒ Object
Returns the value of attribute klass.
10 11 12 |
# File 'lib/dynamoid_advanced_where/nodes/root_node.rb', line 10 def klass @klass end |
Instance Method Details
#allowed_field?(method) ⇒ Boolean
31 32 33 |
# File 'lib/dynamoid_advanced_where/nodes/root_node.rb', line 31 def allowed_field?(method) klass.attributes.key?(method.to_sym) end |
#respond_to_missing?(method, _i) ⇒ Boolean
27 28 29 |
# File 'lib/dynamoid_advanced_where/nodes/root_node.rb', line 27 def respond_to_missing?(method, _i) allowed_field?(method) end |