Class: ActionDispatch::Journey::Nodes::Symbol

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

Overview

:nodoc:

Constant Summary collapse

DEFAULT_EXP =
/[^\.\/\?]+/

Instance Attribute Summary collapse

Attributes inherited from Node

#left, #memo

Instance Method Summary collapse

Methods inherited from Terminal

#terminal?

Methods inherited from Node

#cat?, #each, #group?, #literal?, #star?, #terminal?, #to_dot, #to_s, #to_sym, #type

Constructor Details

#initialize(left) ⇒ Symbol

Returns a new instance of Symbol.



82
83
84
85
86
# File 'lib/action_dispatch/journey/nodes/node.rb', line 82

def initialize(left)
  super
  @regexp = DEFAULT_EXP
  @name = left.tr "*:".freeze, "".freeze
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



79
80
81
# File 'lib/action_dispatch/journey/nodes/node.rb', line 79

def name
  @name
end

#regexpObject Also known as: symbol

Returns the value of attribute regexp.



77
78
79
# File 'lib/action_dispatch/journey/nodes/node.rb', line 77

def regexp
  @regexp
end

Instance Method Details

#default_regexp?Boolean

Returns:

  • (Boolean)


88
89
90
# File 'lib/action_dispatch/journey/nodes/node.rb', line 88

def default_regexp?
  regexp == DEFAULT_EXP
end

#symbol?Boolean

Returns:

  • (Boolean)


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

def symbol?; true; end