Class: Synvert::Core::NodeQuery::Compiler::AttributeList
- Inherits:
-
Object
- Object
- Synvert::Core::NodeQuery::Compiler::AttributeList
- Defined in:
- lib/synvert/core/node_query/compiler/attribute_list.rb
Overview
AttributeList contains one or more Attribute.
Instance Method Summary collapse
-
#initialize(attribute:, rest: nil) ⇒ AttributeList
constructor
Initialize a AttributeList.
-
#match?(node) ⇒ Boolean
Check if the node matches the attribute list.
- #to_s ⇒ Object
Constructor Details
#initialize(attribute:, rest: nil) ⇒ AttributeList
Initialize a AttributeList.
9 10 11 12 |
# File 'lib/synvert/core/node_query/compiler/attribute_list.rb', line 9 def initialize(attribute:, rest: nil) @attribute = attribute @rest = rest end |
Instance Method Details
#match?(node) ⇒ Boolean
Check if the node matches the attribute list.
16 17 18 |
# File 'lib/synvert/core/node_query/compiler/attribute_list.rb', line 16 def match?(node) @attribute.match?(node) && (!@rest || @rest.match?(node)) end |
#to_s ⇒ Object
20 21 22 |
# File 'lib/synvert/core/node_query/compiler/attribute_list.rb', line 20 def to_s "[#{@attribute}]#{@rest}" end |