Class: Padrino::Application

Inherits:
Sinatra::Base
  • Object

Overview

Subclasses of this become independent Padrino applications (stemming from Sinatra::Application). These subclassed applications can be easily mounted into other Padrino applications as well.

Class Method Summary

Instance Method Summary

Class Method Details

.default(option, *args, &block) ⇒ Object

.dependencies ⇒ Array

Returns default list of path globs to load as dependencies. Appends custom dependency patterns to the be loaded for your Application.

Examples:

MyApp.dependencies << "#{Padrino.root}/uploaders/**/*.rb"
MyApp.dependencies << Padrino.root('other_app', 'controllers.rb')

Returns:

  • (Array) — list of path globs to load as dependencies

.layout_path(layout) ⇒ Object

Returns an absolute path of application layout.

Examples:

Admin.layout_path :application #=> "/home/user/test/admin/views/layouts/application"

.prerequisites ⇒ Object

An array of file to load before your app.rb, basically are files which our app depends on.

By default we look for files:

# List of default files that we are looking for:
yourapp/models.rb
yourapp/models/**/*.rb
yourapp/lib.rb
yourapp/lib/**/*.rb

Examples:

Adding a custom prerequisite
MyApp.prerequisites << Padrino.root('my_app', 'custom_model.rb')

.reload! ⇒ TrueClass

Reloads the application files from all defined load paths.

This method is used from our Padrino Reloader during development mode in order to reload the source files.

Examples:

MyApp.reload!

Returns:

  • (TrueClass)

.reset_routes! ⇒ TrueClass

Resets application routes to only routes not defined by the user.

Examples:

MyApp.reset_routes!

Returns:

  • (TrueClass)

.routes ⇒ Object

Returns the routes of our app.

Examples:

MyApp.routes

.run!(options = {}) ⇒ Object

Run the Padrino app as a self-hosted server using Thin, Mongrel or WEBrick (in that order).

See Also:

.view_path(view) ⇒ Object

Returns an absolute path of view in application views folder.

Examples:

Admin.view_path 'users/index' #=> "/home/user/test/admin/views/users/index"

Instance Method Details

#logger ⇒ Padrino::Logger

Returns the logger for this application.

Returns:

© 2010–2020 Padrino
Licensed under the MIT License.
https://www.rubydoc.info/github/padrino/padrino-framework/Padrino/Application