Class: HttpRouter::Node::Path

### Home Classes Methods

### In Files

- lib/padrino-core/application/routing.rb

### Parent

Object

### Methods

- #to_code

### Files

- README.rdoc

### Class/Module Index

Quicksearch

- Padrino
- Padrino::Application
- Padrino::ApplicationLoadError
- Padrino::ApplicationSetupError
- Padrino::Cli
- Padrino::Cli::Adapter
- Padrino::Cli::Base
- Padrino::Erubis
- Padrino::Erubis::SafeBufferEnhancer
- Padrino::Erubis::SafeBufferTemplate
- Padrino::Erubis::Template
- Padrino::Filter
- Padrino::Flash
- Padrino::Flash::Helpers
- Padrino::Flash::Storage
- Padrino::Logger
- Padrino::Logger::Colorize
- Padrino::Logger::Extensions
- Padrino::Logger::Rack
- Padrino::Module
- Padrino::Mounter
- Padrino::Mounter::MounterException
- Padrino::Reloader
- Padrino::Reloader::Rack
- Padrino::Rendering
- Padrino::Rendering::ClassMethods
- Padrino::Rendering::InstanceMethods
- Padrino::Rendering::SafeTemplate
- Padrino::Rendering::TemplateNotFound
- Padrino::Router
- Padrino::Routing
- Padrino::Routing::ClassMethods
- Padrino::Routing::InstanceMethods
- Padrino::Routing::Parent
- Padrino::Routing::UnrecognizedException
- Padrino::Server
- Padrino::ShowExceptions
- Padrino::Tasks
- Padrino::Utils
- HttpRouter
- HttpRouter::Node
- HttpRouter::Node::Path
- HttpRouter::Request
- HttpRouter::Route
- Haml
- Haml::Helpers
- Haml::Util
- Sinatra
- Sinatra::Request
- Slim
- Slim::Template
- Tilt
- Tilt::HamlTemplate
- FileSet
- Kernel
- Module
- Object
- ObjectSpace
- PadrinoTasks
- String
- SupportLite

No matching classes.

# HttpRouter::Node::Path

### Public Instance Methods

to_code() click to toggle source

    # File lib/padrino-core/application/routing.rb, line 142
    def to_code
      path_ivar = inject_root_ivar(self)
      "#{"if !callback && request.path.size == 1 && request.path.first == '' && (request.rack_request.head? || request.rack_request.get?) && request.rack_request.path_info[-1] == ?/
        catch(:pass) do
          response = ::Rack::Response.new
          response.redirect(request.rack_request.path_info[0, request.rack_request.path_info.size - 1], 302)
          return response.finish
        end
      end" if router.redirect_trailing_slash?}

      #{"if request.#{router.ignore_trailing_slash? ? 'path_finished?' : 'path.empty?'}" unless route.match_partially}
        catch(:pass) do
          if callback
            request.called = true
            callback.call(Response.new(request, #{path_ivar}))
          else
            env = request.rack_request.dup.env
            env['router.request'] = request
            env['router.params'] ||= {}
            #{"env['router.params'].merge!(Hash[#{param_names.inspect}.zip(request.params)])" if dynamic?}
            @router.rewrite#{"_partial" if route.match_partially}_path_info(env, request)
            response = @router.process_destination_path(#{path_ivar}, env)
            return response unless router.pass_on_response(response)
          end
        end
      #{"end" unless route.match_partially}"
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.