Class: ActionDispatch::Journey::Nodes::Node

Inherits:
Object
  • Object
show all
Includes:
Enumerable
Defined in:
lib/action_dispatch/journey/nodes/node.rb

Overview

:nodoc:

Direct Known Subclasses

Binary, Or, Terminal, Unary

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(left) ⇒ Node

Returns a new instance of Node.



11
12
13
14
# File 'lib/action_dispatch/journey/nodes/node.rb', line 11

def initialize(left)
  @left = left
  @memo = nil
end

Instance Attribute Details

#leftObject

Returns the value of attribute left.



9
10
11
# File 'lib/action_dispatch/journey/nodes/node.rb', line 9

def left
  @left
end

#memoObject

Returns the value of attribute memo.



9
10
11
# File 'lib/action_dispatch/journey/nodes/node.rb', line 9

def memo
  @memo
end

Instance Method Details

#each(&block) ⇒ Object



16
17
18
# File 'lib/action_dispatch/journey/nodes/node.rb', line 16

def each(&block)
  Visitors::Each.new(block).accept(self)
end

#literal?Boolean

Returns:

  • (Boolean)


41
# File 'lib/action_dispatch/journey/nodes/node.rb', line 41

def literal?; false; end

#nameObject



32
33
34
# File 'lib/action_dispatch/journey/nodes/node.rb', line 32

def name
  left.tr '*:', ''
end

#symbol?Boolean

Returns:

  • (Boolean)


40
# File 'lib/action_dispatch/journey/nodes/node.rb', line 40

def symbol?; false; end

#to_dotObject



24
25
26
# File 'lib/action_dispatch/journey/nodes/node.rb', line 24

def to_dot
  Visitors::Dot.new.accept(self)
end

#to_sObject



20
21
22
# File 'lib/action_dispatch/journey/nodes/node.rb', line 20

def to_s
  Visitors::String.new.accept(self)
end

#to_symObject



28
29
30
# File 'lib/action_dispatch/journey/nodes/node.rb', line 28

def to_sym
  name.to_sym
end

#typeObject

Raises:

  • (NotImplementedError)


36
37
38
# File 'lib/action_dispatch/journey/nodes/node.rb', line 36

def type
  raise NotImplementedError
end