Class: Tilt::Jbuilder
- Inherits:
-
Jbuilder
- Object
- Jbuilder
- Tilt::Jbuilder
- Defined in:
- lib/tilt/jbuilder.rb
Instance Method Summary collapse
-
#initialize(scope, *args, &block) ⇒ Jbuilder
constructor
A new instance of Jbuilder.
- #partial!(options, locals = {}) ⇒ Object
Constructor Details
#initialize(scope, *args, &block) ⇒ Jbuilder
Returns a new instance of Jbuilder.
6 7 8 9 |
# File 'lib/tilt/jbuilder.rb', line 6 def initialize(scope, *args, &block) @scope = scope super(*args, &block) end |
Instance Method Details
#partial!(options, locals = {}) ⇒ Object
11 12 13 14 15 16 |
# File 'lib/tilt/jbuilder.rb', line 11 def partial!(, locals = {}) locals.merge! :json => self view_path = @scope.instance_variable_get('@_jbuilder_view_path') template = ::Tilt::JbuilderTemplate.new(fetch_partial_path(.to_s, view_path), nil, view_path: view_path) template.render(@scope, locals) end |