Parent

Methods

Class/Module Index [+]

Quicksearch

Ferret::Browser::Delegator

Public Class Methods

new(reader, path) click to toggle source
# File lib/ferret/browser.rb, line 6
def initialize(reader, path)
  @reader, @path = reader, path
end

Public Instance Methods

run(env) click to toggle source
# File lib/ferret/browser.rb, line 10
def run(env)
  controller, action, args = :home, :index, nil
  query_string = env['QUERY_STRING']||''
  params = parse_query_string(query_string)
  req_path = env['PATH_INFO'].gsub(/\/+/, '/')
  case req_path
  when '/'
    # nothing to do
  when /^\/?([-a-zA-Z]+)\/?$/
    controller = $1
  when /^\/?([-a-zA-Z]+)\/([-a-zA-Z]+)\/?(.*)?$/
    controller = $1
    action = $2
    args = $3
  else
    controller = :error
    args = req_path
  end
  controller_vars = {
    :params => params,
    :req_path => req_path,
    :query_string => query_string,
  }
  delegate(controller, action, args, controller_vars)
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.