Class: CbuilderTemplate
- Defined in:
- lib/cbuilder_template.rb
Instance Method Summary collapse
-
#initialize(context, *args) ⇒ CbuilderTemplate
constructor
A new instance of CbuilderTemplate.
- #partial!(options, locals = {}) ⇒ Object
Methods inherited from Cbuilder
encode, #set!, #set_collection!, #target!
Constructor Details
#initialize(context, *args) ⇒ CbuilderTemplate
Returns a new instance of CbuilderTemplate.
2 3 4 5 |
# File 'lib/cbuilder_template.rb', line 2 def initialize(context, *args) @context = context super(*args) end |
Instance Method Details
#partial!(options, locals = {}) ⇒ Object
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/cbuilder_template.rb', line 7 def partial!(, locals = {}) case when Hash [:locals] ||= {} [:locals].merge!(:csv => self) @context.render(.reverse_merge(:formats => [:csv])) else @context.render(:partial => , :locals => locals.merge(:csv => self), :formats => [:csv]) end end |