Class: AdvancedSearch::AST::Base
- Inherits:
-
Object
- Object
- AdvancedSearch::AST::Base
- Defined in:
- lib/advanced_search/ast/base.rb
Instance Attribute Summary collapse
-
#edges ⇒ Object
readonly
Returns the value of attribute edges.
Instance Method Summary collapse
- #add_edge(other_node) ⇒ Object
-
#initialize ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize ⇒ Base
Returns a new instance of Base.
4 5 6 |
# File 'lib/advanced_search/ast/base.rb', line 4 def initialize @edges = [] end |
Instance Attribute Details
#edges ⇒ Object (readonly)
Returns the value of attribute edges.
8 9 10 |
# File 'lib/advanced_search/ast/base.rb', line 8 def edges @edges end |
Instance Method Details
#add_edge(other_node) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/advanced_search/ast/base.rb', line 10 def add_edge(other_node) unless other_node.is_a?(Base) raise( TypeError, format( 'Invalid AST edge. Expected AdvancedSearch::AST::Base, got %s', other_node ) ) end @edges.push(other_node) end |