### Home Classes Methods

### In Files

- lib/merb-core/rack/adapter/irb.rb

### Parent

Object

### Methods

- #close_sandbox!
- #open_sandbox!
- #reload!
- #resource
- #route_to
- #show_routes
- #trace_log!
- #url

### Files

- CHANGELOG
- LICENSE
- README
- TODO

### Class/Module Index

Quicksearch

- Merb
- Merb::AbstractController
- Merb::AcceptType
- Merb::AuthenticationMixin
- Merb::AuthenticationMixin::BasicAuthentication
- Merb::BootLoader
- Merb::BootLoader::AfterAppLoads
- Merb::BootLoader::BackgroundServices
- Merb::BootLoader::BeforeAppLoads
- Merb::BootLoader::BuildFramework
- Merb::BootLoader::ChooseAdapter
- Merb::BootLoader::Cookies
- Merb::BootLoader::Defaults
- Merb::BootLoader::Dependencies
- Merb::BootLoader::DropPidFile
- Merb::BootLoader::LoadClasses
- Merb::BootLoader::Logger
- Merb::BootLoader::MimeTypes
- Merb::BootLoader::MixinSession
- Merb::BootLoader::RackUpApplication
- Merb::BootLoader::ReloadClasses
- Merb::BootLoader::ReloadClasses::TimedExecutor
- Merb::BootLoader::Router
- Merb::BootLoader::SetupSession
- Merb::BootLoader::SetupStubClasses
- Merb::BootLoader::Templates
- Merb::ConditionalGetMixin
- Merb::Config
- Merb::Config::ConfigBlock
- Merb::Const
- Merb::Controller
- Merb::ControllerExceptions
- Merb::ControllerExceptions::Accepted
- Merb::ControllerExceptions::ActionNotFound
- Merb::ControllerExceptions::BadGateway
- Merb::ControllerExceptions::BadRequest
- Merb::ControllerExceptions::Base
- Merb::ControllerExceptions::ClientError
- Merb::ControllerExceptions::Conflict
- Merb::ControllerExceptions::Continue
- Merb::ControllerExceptions::Created
- Merb::ControllerExceptions::ExpectationFailed
- Merb::ControllerExceptions::Forbidden
- Merb::ControllerExceptions::GatewayTimeout
- Merb::ControllerExceptions::Gone
- Merb::ControllerExceptions::HTTPVersionNotSupported
- Merb::ControllerExceptions::Informational
- Merb::ControllerExceptions::InternalServerError
- Merb::ControllerExceptions::LayoutNotFound
- Merb::ControllerExceptions::LengthRequired
- Merb::ControllerExceptions::MethodNotAllowed
- Merb::ControllerExceptions::MovedPermanently
- Merb::ControllerExceptions::MovedTemporarily
- Merb::ControllerExceptions::MultiPartParseError
- Merb::ControllerExceptions::MultipleChoices
- Merb::ControllerExceptions::NoContent
- Merb::ControllerExceptions::NonAuthoritativeInformation
- Merb::ControllerExceptions::NotAcceptable
- Merb::ControllerExceptions::NotFound
- Merb::ControllerExceptions::NotImplemented
- Merb::ControllerExceptions::NotModified
- Merb::ControllerExceptions::OK
- Merb::ControllerExceptions::PartialContent
- Merb::ControllerExceptions::PaymentRequired
- Merb::ControllerExceptions::PreconditionFailed
- Merb::ControllerExceptions::ProxyAuthenticationRequired
- Merb::ControllerExceptions::Redirection
- Merb::ControllerExceptions::RequestEntityTooLarge
- Merb::ControllerExceptions::RequestRangeNotSatisfiable
- Merb::ControllerExceptions::RequestTimeout
- Merb::ControllerExceptions::RequestURITooLarge
- Merb::ControllerExceptions::ResetContent
- Merb::ControllerExceptions::SeeOther
- Merb::ControllerExceptions::ServerError
- Merb::ControllerExceptions::ServiceUnavailable
- Merb::ControllerExceptions::Successful
- Merb::ControllerExceptions::SwitchingProtocols
- Merb::ControllerExceptions::TemplateNotFound
- Merb::ControllerExceptions::TemporaryRedirect
- Merb::ControllerExceptions::Unauthorized
- Merb::ControllerExceptions::UnsupportedMediaType
- Merb::ControllerExceptions::UseProxy
- Merb::ControllerMixin
- Merb::CookieSession
- Merb::CookieSession::CookieOverflow
- Merb::CookieSession::TamperedWithCookie
- Merb::Cookies
- Merb::CookiesMixin
- Merb::CookiesMixin::RequestMixin
- Merb::Counter
- Merb::Dispatcher
- Merb::Dispatcher::DefaultException
- Merb::Dispatcher::DefaultExceptionHelper
- Merb::GlobalHelpers
- Merb::InlineTemplates
- Merb::Logger
- Merb::MemcacheSession
- Merb::MemcacheStore
- Merb::MemorySession
- Merb::MemorySessionStore
- Merb::Parse
- Merb::Plugins
- Merb::Rack
- Merb::Rack::AbstractAdapter
- Merb::Rack::Adapter
- Merb::Rack::Application
- Merb::Rack::ConditionalGet
- Merb::Rack::Console
- Merb::Rack::ContentLength
- Merb::Rack::DeferrableMiddleware
- Merb::Rack::Ebb
- Merb::Rack::EventedMongrel
- Merb::Rack::FastCGI
- Merb::Rack::Handler
- Merb::Rack::Handler::Mongrel
- Merb::Rack::Head
- Merb::Rack::Helpers
- Merb::Rack::Irb
- Merb::Rack::Middleware
- Merb::Rack::Mongrel
- Merb::Rack::PathPrefix
- Merb::Rack::Profiler
- Merb::Rack::Runner
- Merb::Rack::Static
- Merb::Rack::StreamWrapper
- Merb::Rack::SwiftipliedMongrel
- Merb::Rack::Thin
- Merb::Rack::ThinTurbo
- Merb::Rack::Tracer
- Merb::Rack::WEBrick
- Merb::RenderMixin
- Merb::RenderMixin::ClassMethods
- Merb::Request
- Merb::ReservedError
- Merb::Responder
- Merb::ResponderMixin
- Merb::ResponderMixin::ClassMethods
- Merb::ResponderMixin::ContentTypeAlreadySet
- Merb::Router
- Merb::Router::Behavior
- Merb::Router::Behavior::Error
- Merb::Router::Behavior::Proxy
- Merb::Router::CachedProc
- Merb::Router::GenerationError
- Merb::Router::NotCompiledError
- Merb::Router::Resources
- Merb::Router::RouteNotFound
- Merb::Server
- Merb::Session
- Merb::SessionContainer
- Merb::SessionMixin
- Merb::SessionMixin::NoSessionContainer
- Merb::SessionMixin::RequestMixin
- Merb::SessionMixin::RequestMixin::ClassMethods
- Merb::SessionMixin::SessionOverflow
- Merb::SessionStoreContainer
- Merb::System
- Merb::System::PortablePoller
- Merb::Template
- Merb::Template::Erubis
- Merb::Template::Erubis::Mixin
- Merb::Test
- Merb::Test::ControllerHelper
- Merb::Test::Cookie
- Merb::Test::CookieJar
- Merb::Test::ExampleGroup
- Merb::Test::Helpers
- Merb::Test::MakeRequest
- Merb::Test::Matchers
- Merb::Test::MultipartRequestHelper
- Merb::Test::MultipartRequestHelper::FileParam
- Merb::Test::MultipartRequestHelper::Param
- Merb::Test::MultipartRequestHelper::Post
- Merb::Test::RequestHelper
- Merb::Test::RequestHelper::CookieJar
- Merb::Test::RequestHelper::FakeRequest
- Merb::Test::RouteHelper
- Merb::Test::Rspec
- Merb::Test::Rspec::ControllerMatchers
- Merb::Test::Rspec::ControllerMatchers::BeError
- Merb::Test::Rspec::ControllerMatchers::BeRedirect
- Merb::Test::Rspec::ControllerMatchers::Provide
- Merb::Test::Rspec::RouteMatchers
- Merb::Test::Rspec::RouteMatchers::ParameterMatcher
- Merb::Test::Rspec::RouteMatchers::RouteToMatcher
- Merb::Test::ViewHelper
- Merb::Test::WebratHelper
- Merb::Worker
- Erubis
- Erubis::Basic
- Erubis::Basic::Converter
- Erubis::BlockAwareEnhancer
- Erubis::BlockAwareEruby
- Erubis::MEruby
- Spec
- Spec::Matchers
- Spec::Matchers::MatcherDSL
- Spec::Runner
- Spec::Runner::Formatter
- Spec::Runner::Formatter::BaseTextFormatter
- Gem
- Gem::Dependency
- Hpricot
- Hpricot::Elem
- Mongrel
- Mongrel::HttpResponse
- Class
- Exception
- Hash
- Kernel
- MemCache
- Memcached
- Object
- String
- Time

No matching classes.

# Merb::Rack::Console

### Public Instance Methods

close_sandbox!() click to toggle source

Ends a sandboxed session (delegates to any Merb::Orms::* modules).

An ORM should implement Merb::Orms::MyOrm#close_sandbox! to support this. Usually this involves rolling back a transaction. :api: public

    # File lib/merb-core/rack/adapter/irb.rb, line 155
    def close_sandbox!
      orm_modules.each { |orm| orm.close_sandbox! if orm.respond_to?(:close_sandbox!) }
      puts "Modifications have been rolled back"
    end

open_sandbox!() click to toggle source

Starts a sandboxed session (delegates to any Merb::Orms::* modules).

An ORM should implement Merb::Orms::MyOrm#open_sandbox! to support this. Usually this involves starting a transaction. :api: public

    # File lib/merb-core/rack/adapter/irb.rb, line 144
    def open_sandbox!
      puts "Loading #{Merb.environment} environment in sandbox (Merb #{Merb::VERSION})"
      puts "Any modifications you make will be rolled back on exit"
      orm_modules.each { |orm| orm.open_sandbox! if orm.respond_to?(:open_sandbox!) }
    end

reload!() click to toggle source

Reloads classes using Merb::BootLoader::ReloadClasses. :api: public

    # File lib/merb-core/rack/adapter/irb.rb, line 99
    def reload!
      Merb::BootLoader::ReloadClasses.reload!
    end

resource(*args) click to toggle source

Generates a URL for a single or nested resource.

#### Parameters

resources<Symbol,Object> | The resources for which the URL

    should be generated. These resources should be specified
    in the router.rb file using #resources and #resource.

options<Hash> | Any extra parameters that are needed to

    generate the URL.

#### Returns

String | The generated URL.

#### Examples

Merb::Router.prepare do

    resources :users do
      resources :comments
    end

end

resource(:users) # => /users resource(@user) # => /users/10 resource(@user, :comments) # => /users/10/comments resource(@user, @comment) # => /users/10/comments/15 resource(:users, :new) # => /users/new resource(:@user, :edit) # => /users/10/edit

:api: public

    # File lib/merb-core/rack/adapter/irb.rb, line 92
    def resource(*args)
      args << {}
      Merb::Router.resource(*args)
    end

route_to(url, method = :get, env_overrides = {}) click to toggle source

Returns a request for a specific URL and method. :api: public

    # File lib/merb-core/rack/adapter/irb.rb, line 105
    def route_to(url, method = :get, env_overrides = {})
      request_env = ::Rack::MockRequest.env_for(url)
      request_env["REQUEST_METHOD"] = method.to_s
      Merb::Router.route_for(Merb::Request.new(request_env.merge(env_overrides)))
    end

show_routes() click to toggle source

Prints all routes for the application. :api: public

    # File lib/merb-core/rack/adapter/irb.rb, line 113
    def show_routes
      seen = []
      unless Merb::Router.named_routes.empty?
        puts "==== Named routes"
        Merb::Router.named_routes.each do |name,route|
          # something weird happens when you combine sprintf and irb
          puts "Helper     : #{name}"
          meth = $1.upcase if route.conditions[:method].to_s =~ /(get|post|put|delete)/
          puts "HTTP method: #{meth || 'GET'}"
          puts "Route      : #{route}"
          puts "Params     : #{route.params.inspect}"
          puts
          seen << route
        end
      end
      puts "==== Anonymous routes"
      (Merb::Router.routes - seen).each do |route|
        meth = $1.upcase if route.conditions[:method].to_s =~ /(get|post|put|delete)/
        puts "HTTP method: #{meth || 'GET'}"
        puts "Route      : #{route}"
        puts "Params     : #{route.params.inspect}"
        puts
      end
      nil
    end

trace_log!() click to toggle source

Explictly show logger output during IRB session :api: public

    # File lib/merb-core/rack/adapter/irb.rb, line 162
    def trace_log!
      Merb.logger.auto_flush = true
    end

url(name, *args) click to toggle source

There are three possible ways to use this method. First, if you have a named route, you can specify the route as the first parameter as a symbol and any paramters in a hash. Second, you can generate the default route by just passing the params hash, just passing the params hash. Finally, you can use the anonymous parameters. This allows you to specify the parameters to a named route in the order they appear in the router.

#### Parameters(Named Route)

name<Symbol> | The name of the route.
args<Hash> | Parameters for the route generation.

#### Parameters(Default Route)

args<Hash> | Parameters for the route generation. This route will use the default route.

#### Parameters(Anonymous Parameters)

name<Symbol> | The name of the route.
args<Array> | An array of anonymous parameters to generate the route with. These parameters are assigned to the route parameters in the order that they are passed.

#### Returns

String | The generated URL.

#### Examples

Named Route

Merb::Router.prepare do

    match("/articles/:title").to(:controller => :articles, :action => :show).name("articles")

end

url(:articles, :title => "new_article")

Default Route

Merb::Router.prepare do

    default_routes

end

url(:controller => "articles", :action => "new")

Anonymous Paramters

Merb::Router.prepare do

    match("/articles/:year/:month/:title").to(:controller => :articles, :action => :show).name("articles")

end

url(:articles, 2008, 10, "test_article")

:api: public

    # File lib/merb-core/rack/adapter/irb.rb, line 58
    def url(name, *args)
      args << {}
      Merb::Router.url(name, *args)
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.