Class: Jv::Render
- Inherits:
-
Object
- Object
- Jv::Render
- Defined in:
- lib/jv/render.rb
Instance Method Summary collapse
- #call(options) ⇒ Object
-
#initialize(context) ⇒ Render
constructor
A new instance of Render.
Constructor Details
#initialize(context) ⇒ Render
Returns a new instance of Render.
3 4 5 |
# File 'lib/jv/render.rb', line 3 def initialize(context) @context = context end |
Instance Method Details
#call(options) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/jv/render.rb', line 7 def call() render_collection = [:collection].present? [:locals] ||= {} [:locals].merge!(r: self, _partial: true) if render_collection json = @context.render if render_collection json.prepend('[') json[-1] = ']' end JSON.load(json) end |