Class: ActionDispatch::Journey::Ast
- Defined in:
- actionpack/lib/action_dispatch/journey/nodes/node.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#names ⇒ Object
readonly
Returns the value of attribute names.
-
#path_params ⇒ Object
readonly
Returns the value of attribute path_params.
-
#terminals ⇒ Object
readonly
Returns the value of attribute terminals.
-
#tree ⇒ Object
(also: #root)
readonly
Returns the value of attribute tree.
-
#wildcard_options ⇒ Object
readonly
Returns the value of attribute wildcard_options.
Instance Method Summary collapse
- #glob? ⇒ Boolean
-
#initialize(tree, formatted) ⇒ Ast
constructor
A new instance of Ast.
- #requirements=(requirements) ⇒ Object
- #route=(route) ⇒ Object
Constructor Details
#initialize(tree, formatted) ⇒ Ast
Returns a new instance of Ast.
11 12 13 14 15 16 17 18 19 20 21 |
# File 'actionpack/lib/action_dispatch/journey/nodes/node.rb', line 11 def initialize(tree, formatted) @tree = tree @path_params = [] @names = [] @symbols = [] @stars = [] @terminals = [] @wildcard_options = {} visit_tree(formatted) end |
Instance Attribute Details
#names ⇒ Object (readonly)
Returns the value of attribute names
8 9 10 |
# File 'actionpack/lib/action_dispatch/journey/nodes/node.rb', line 8 def names @names end |
#path_params ⇒ Object (readonly)
Returns the value of attribute path_params
8 9 10 |
# File 'actionpack/lib/action_dispatch/journey/nodes/node.rb', line 8 def path_params @path_params end |
#terminals ⇒ Object (readonly)
Returns the value of attribute terminals
8 9 10 |
# File 'actionpack/lib/action_dispatch/journey/nodes/node.rb', line 8 def terminals @terminals end |
#tree ⇒ Object (readonly) Also known as: root
Returns the value of attribute tree
8 9 10 |
# File 'actionpack/lib/action_dispatch/journey/nodes/node.rb', line 8 def tree @tree end |
#wildcard_options ⇒ Object (readonly)
Returns the value of attribute wildcard_options
8 9 10 |
# File 'actionpack/lib/action_dispatch/journey/nodes/node.rb', line 8 def @wildcard_options end |
Instance Method Details
#glob? ⇒ Boolean
37 38 39 |
# File 'actionpack/lib/action_dispatch/journey/nodes/node.rb', line 37 def glob? stars.any? end |
#requirements=(requirements) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'actionpack/lib/action_dispatch/journey/nodes/node.rb', line 23 def requirements=(requirements) # inject any regexp requirements for `star` nodes so they can be # determined nullable, which requires knowing if the regex accepts an # empty string. (symbols + stars).each do |node| re = requirements[node.to_sym] node.regexp = re if re end end |
#route=(route) ⇒ Object
33 34 35 |
# File 'actionpack/lib/action_dispatch/journey/nodes/node.rb', line 33 def route=(route) terminals.each { |n| n.memo = route } end |