Module: Roda::RodaPlugins::SymbolViews
- Defined in:
- lib/roda/plugins/symbol_views.rb
Overview
The symbol_views plugin allows match blocks to return symbols, and consider those symbols as views to use for the response body. So you can take code like:
r.root do
view :index
end
r.is "foo" do
view :foo
end
and DRY it up:
r.root do
:index
end
r.is "foo" do
:foo
end
Class Method Summary collapse
Class Method Details
.configure(app) ⇒ Object
30 31 32 |
# File 'lib/roda/plugins/symbol_views.rb', line 30 def self.configure(app) app.opts[:custom_block_results][Symbol] = :view end |
.load_dependencies(app) ⇒ Object
26 27 28 |
# File 'lib/roda/plugins/symbol_views.rb', line 26 def self.load_dependencies(app) app.plugin :custom_block_results end |