Class: Rack::App::Router::Tree

Inherits:
Object
  • Object
show all
Defined in:
lib/rack/app/router/tree.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeTree

Returns a new instance of Tree.



12
13
14
# File 'lib/rack/app/router/tree.rb', line 12

def initialize
  @root = self.class::Branch.new
end

Instance Attribute Details

#rootObject (readonly)

Returns the value of attribute root.



10
11
12
# File 'lib/rack/app/router/tree.rb', line 10

def root
  @root
end

Instance Method Details

#add(endpoint) ⇒ Object



16
17
18
# File 'lib/rack/app/router/tree.rb', line 16

def add(endpoint)
  @root.set(self.class::Env.new(endpoint))
end

#call(env) ⇒ Object



20
21
22
23
# File 'lib/rack/app/router/tree.rb', line 20

def call(env)
  configure_request(env)
  @root.call(env, *env[Rack::App::Constants::ENV::SPLITTED_PATH_INFO])
end