Module: Sinatra::Bldr::Helpers
- Defined in:
- lib/sinatra/bldr.rb
Instance Method Summary collapse
-
#bldr(template, opts = {}, &block) ⇒ Object
Wrapper for Tilt’s ‘render` method.
Instance Method Details
#bldr(template, opts = {}, &block) ⇒ Object
Wrapper for Tilt’s ‘render` method
We use this to properly set the scope the template gets rendered within to a ‘Bldr::Node` object and pass in local variables.
25 26 27 28 29 30 31 32 33 |
# File 'lib/sinatra/bldr.rb', line 25 def bldr(template, opts = {}, &block) opts[:parent] = self opts[:scope] = ::Bldr::Node.new(nil, opts.merge(:views => (settings.views || "./views"))) locals = opts.delete(:locals) || {} # @todo add support for alternate formats, like plist MultiJson.encode render(:bldr, template, opts, locals, &block).result end |