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 =
/[^.\/?]+/
GREEDY_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

Methods included from Enumerable

#as_json, #compact_blank, #exclude?, #excluding, #in_order_of, #including, #index_by, #index_with, #many?, #maximum, #minimum, #pick, #pluck, #sole

Constructor Details

#initialize(left, regexp = DEFAULT_EXP) ⇒ Symbol

Returns a new instance of Symbol.



143
144
145
146
147
# File 'actionpack/lib/action_dispatch/journey/nodes/node.rb', line 143

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

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



139
140
141
# File 'actionpack/lib/action_dispatch/journey/nodes/node.rb', line 139

def name
  @name
end

#regexpObject Also known as: symbol

Returns the value of attribute regexp.



137
138
139
# File 'actionpack/lib/action_dispatch/journey/nodes/node.rb', line 137

def regexp
  @regexp
end

Instance Method Details

#symbol?Boolean

Returns:

  • (Boolean)


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

def symbol?; true; end

#typeObject



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

def type; :SYMBOL; end