W3cubDocs

/Padrino

Class: Padrino::Mounter

Inherits:
Object
  • Object

Overview

Represents a particular mounted Padrino application. Stores the name of the application (app folder name) and url mount path.

Examples:

Mounter.new("blog_app", :app_class => "Blog").to("/blog")
Mounter.new("blog_app", :app_file => "/path/to/blog/app.rb").to("/blog")

Defined Under Namespace

Modules: ApplicationExtension Classes: MounterException

Constant Summary

DEFAULT_CASCADE =
[404, 405]

Instance Attribute Summary

Instance Method Summary

Constructor Details

#initialize(name, options = {}) ⇒ Mounter

Returns a new instance of Mounter

Parameters:

Options Hash (options):

  • :app_class (Symbol) — default: Detected from name
  • :app_file (Symbol) — default: Automatically detected
  • :app_obj (Symbol) — default: Detected
  • :app_root (Symbol) — default: Directory of :app_file
  • :gem (Symbol) — The gem to load the app from (Detected from name)

Instance Attribute Details

#app_class ⇒ Object

Returns the value of attribute app_class

#app_file ⇒ Object

Returns the value of attribute app_file

#app_host ⇒ Object

Returns the value of attribute app_host

#app_obj ⇒ Object

Returns the value of attribute app_obj

#app_root ⇒ Object

Returns the value of attribute app_root

#cascade ⇒ Object

Returns the value of attribute cascade

#name ⇒ Object

Returns the value of attribute name

#uri_root ⇒ Object

Returns the value of attribute uri_root

Instance Method Details

#==(other) ⇒ Object

Makes two Mounters equal if they have the same name and uri_root.

Parameters:

#app_constant ⇒ Padrino::Application

Returns the class object for the app if defined, nil otherwise.

Returns:

#host(mount_host) ⇒ Object

Registers the mounted application onto Padrino for the given host.

Examples:

Mounter.new("blog_app").to("/blog").host("blog.padrino.org")
Mounter.new("blog_app").host("blog.padrino.org")
Mounter.new("catch_all").host(/.*\.padrino.org/)

Parameters:

  • mount_host (String) — Host name.

#map_onto(router) ⇒ Padrino::Router

Maps Padrino application onto a Padrino::Router. For use in constructing a Rack application.

Examples:

@app.map_onto(router)

Parameters:

Returns:

#named_routes ⇒ Array

Returns the basic route information for each named route.

Returns:

  • (Array) — Array of routes.

#padrino_application? ⇒ Boolean

Returns:

  • (Boolean)

#routes ⇒ Object

Returns the route objects for the mounted application.

#to(mount_url) ⇒ Object

Registers the mounted application onto Padrino.

Examples:

Mounter.new("blog_app").to("/blog")

Parameters:

  • mount_url (String) — Path where we mount the app.

© 2010–2016 Padrino
Licensed under the MIT License.
http://www.rubydoc.info/github/padrino/padrino-framework/Padrino/Mounter