class Rack::App::Router::Tree::Branch
Public Instance Methods
call(env, current, *path_info_parts)
click to toggle source
# File lib/rack/app/router/tree/branch.rb, line 12 def call(env, current, *path_info_parts) if path_info_parts.empty? try_leaf { |l| l.call_endpoint(env, current) || l.call_mount(env) } else next_branch = self[current] || self[:ANY] resp = next_branch && next_branch.call(env, *path_info_parts) resp || try_leaf { |l| l.call_mount(env) } end end
set(env)
click to toggle source
# File lib/rack/app/router/tree/branch.rb, line 4 def set(env) if env.branch? branch_for(env.save_key).set(env.next) else leaf.set(env) end end
Protected Instance Methods
branch_for(save_key)
click to toggle source
# File lib/rack/app/router/tree/branch.rb, line 29 def branch_for(save_key) self[save_key] ||= self.class.new end
leaf()
click to toggle source
# File lib/rack/app/router/tree/branch.rb, line 33 def leaf self[:LEAF] ||= Rack::App::Router::Tree::Leaf.new end
try_leaf() { |leaf| ... }
click to toggle source
# File lib/rack/app/router/tree/branch.rb, line 24 def try_leaf leaf = self[:LEAF] leaf && yield(leaf) end