Class: Rage::Router::Node

Inherits:
Object
  • Object
show all
Defined in:
lib/rage/router/node.rb

Direct Known Subclasses

ParentNode, WildcardNode

Constant Summary collapse

STATIC =
0
PARAMETRIC =
1
WILDCARD =
2

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNode

Returns a new instance of Node.



13
14
15
16
17
# File 'lib/rage/router/node.rb', line 13

def initialize
  @is_leaf_node = false
  @routes = nil
  @handler_storage = nil
end

Instance Attribute Details

#handler_storageObject (readonly)

Returns the value of attribute handler_storage.



11
12
13
# File 'lib/rage/router/node.rb', line 11

def handler_storage
  @handler_storage
end

#is_leaf_nodeObject (readonly)

Returns the value of attribute is_leaf_node.



11
12
13
# File 'lib/rage/router/node.rb', line 11

def is_leaf_node
  @is_leaf_node
end

#kindObject (readonly)

Returns the value of attribute kind.



11
12
13
# File 'lib/rage/router/node.rb', line 11

def kind
  @kind
end

Instance Method Details

#add_route(route, constrainer) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/rage/router/node.rb', line 19

def add_route(route, constrainer)
  @routes ||= []
  @handler_storage ||= HandlerStorage.new

  @is_leaf_node = true
  @routes << route
  @handler_storage.add_handler(constrainer, route)
end