Class: JbuilderTemplate

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

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Jbuilder

#array!, #attributes!, #call, #child!, #extract!, #set!, #target!

Constructor Details

#initialize(context) ⇒ JbuilderTemplate

Returns a new instance of JbuilderTemplate.



6
7
8
9
# File 'lib/jbuilder_template.rb', line 6

def initialize(context)
  @context = context
  super()
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Jbuilder

Class Method Details

.encode(context) ⇒ Object



2
3
4
# File 'lib/jbuilder_template.rb', line 2

def self.encode(context)
  new(context)._tap { |jbuilder| yield jbuilder }.target!
end

Instance Method Details

#partial!(partial_name, options = {}) ⇒ Object



11
12
13
# File 'lib/jbuilder_template.rb', line 11

def partial!(partial_name, options = {})
  @context.render(partial_name, options.merge(:json => self))
end