Class: JbuilderTemplate
- Defined in:
- lib/jbuilder_template.rb
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(context) ⇒ JbuilderTemplate
constructor
A new instance of JbuilderTemplate.
- #partial!(partial_name, options = {}) ⇒ Object
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, = {}) @context.render(partial_name, .merge(:json => self)) end |