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, #including, #index_by, #index_with, #many?, #pick, #pluck, #sum, #without

Constructor Details

#initialize(left, regexp = DEFAULT_EXP) ⇒ Symbol

Returns a new instance of Symbol.


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

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


79
80
81
# File 'actionpack/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 'actionpack/lib/action_dispatch/journey/nodes/node.rb', line 77

def regexp
  @regexp
end

Instance Method Details

#default_regexp?Boolean

Returns:

  • (Boolean)

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

def default_regexp?
  regexp == DEFAULT_EXP
end

#symbol?Boolean

Returns:

  • (Boolean)

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

def symbol?; true; end

#typeObject


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

def type; :SYMBOL; end