Class: Tilt::Jbuilder

Inherits:
Jbuilder
  • Object
show all
Defined in:
lib/tilt/jbuilder.rb

Instance Method Summary collapse

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!(options, locals = {})
  locals.merge! :json => self
  view_path = @scope.instance_variable_get('@_jbuilder_view_path')
  template = ::Tilt::JbuilderTemplate.new(fetch_partial_path(options.to_s, view_path), nil, view_path: view_path)
  template.render(@scope, locals)
end