module Roda::RodaPlugins::SymbolViews

  1. lib/roda/plugins/symbol_views.rb

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

Methods

Public Class

  1. configure

Public Class methods

configure(app)
[show source]
   # File lib/roda/plugins/symbol_views.rb
26 def self.configure(app)
27   app.plugin :custom_block_results
28   app.opts[:custom_block_results][Symbol] = :view
29 end