Class: AdvancedSearch::AST::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/advanced_search/ast/base.rb

Direct Known Subclasses

And, Eq, Id, Lt, Or, Value

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeBase

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

#edgesObject (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