class Rack::App::Router::Tree::Leaf

Constants

E

Public Instance Methods

call_endpoint(env, current_path) click to toggle source
# File lib/rack/app/router/tree/leaf.rb, line 19
def call_endpoint(env, current_path)
  app = self[current_path] || self[:ANY]
  (app && app.call(env)) || call_mount(env)
end
call_mount(env) click to toggle source
# File lib/rack/app/router/tree/leaf.rb, line 24
def call_mount(env)
  app = self[:MOUNT_POINT] || self[:APPLICATION]
  app && app.call(env)
end
set(env) click to toggle source
# File lib/rack/app/router/tree/leaf.rb, line 8
def set(env)
  case env.type
  when :APPLICATION
    self[env.type] = Rack::App::Router::Tree::Leaf::Mounted::Application.new(env.endpoint)
  when :MOUNT_POINT
    self[env.type] = Rack::App::Router::Tree::Leaf::Mounted.new(env.endpoint)
  else
    save_endpoint(env)
  end
end

Protected Instance Methods

save_endpoint(env) click to toggle source
# File lib/rack/app/router/tree/leaf.rb, line 31
def save_endpoint(env)
  if env.save_key.is_a?(Symbol)
    vein_for(env.save_key).set(env)
  else
    split_save_to_extnames(env)
  end
end
split_save_to_extnames(env) click to toggle source
# File lib/rack/app/router/tree/leaf.rb, line 39
def split_save_to_extnames(env)
  save_key = env.save_key
  env.endpoint.config.serializer.extnames.each do |extname|
    vein_for(save_key + extname).set(env)
  end
  vein_for(save_key).set(env)
end
vein_for(path_part) click to toggle source
# File lib/rack/app/router/tree/leaf.rb, line 47
def vein_for(path_part)
  self[path_part] ||= Rack::App::Router::Tree::Vein.new
end