Module: Mullet::Sinatra
- Defined in:
- lib/mullet/sinatra.rb,
lib/mullet/sinatra/engine.rb
Overview
Sinatra extension for rendering views with Mullet.
Example:
require 'mullet/sinatra'
class App < Sinatra::Base
register Mullet::Sinatra
set :mullet, {
# path to folder containing template .html files. If not set, then
# default is `settings.views`
template_path: "views"
}
get '/' do
mullet :index
end
end
When ‘mullet :index` is called, the engine will attempt to load a Ruby view class named `Views::Index` from the `views/index.rb` file. If the view class is not found, then the engine will render the template file `view/index.html` directly.
By default, the rendered page will passed to a layout view named ‘:layout`. The rendered page content is passed to the layout template in the variable `content`.
Defined Under Namespace
Modules: Helpers Classes: Engine
Class Method Summary collapse
-
.registered(app) ⇒ Object
Called when this extension is registered.