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

Inherits:
Terminal show all
Defined in:
actionpack/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

Methods included from Enumerable

#as_json, #exclude?, #index_by, #many?, #pluck, #sum, #without

Constructor Details

#initialize(left) ⇒ Symbol

Returns a new instance of Symbol.


80
81
82
83
84
# File 'actionpack/lib/action_dispatch/journey/nodes/node.rb', line 80

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name


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

def name
  @name
end

#regexpObject Also known as: symbol

Returns the value of attribute regexp


75
76
77
# File 'actionpack/lib/action_dispatch/journey/nodes/node.rb', line 75

def regexp
  @regexp
end

Instance Method Details

#default_regexp?Boolean

Returns:

  • (Boolean)

86
87
88
# File 'actionpack/lib/action_dispatch/journey/nodes/node.rb', line 86

def default_regexp?
  regexp == DEFAULT_EXP
end

#symbol?Boolean

Returns:

  • (Boolean)

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

def symbol?; true; end