Class: Yj::Render
- Inherits:
-
Object
- Object
- Yj::Render
- Defined in:
- lib/yj/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/yj/render.rb', line 3 def initialize(context) @context = context end |
Instance Method Details
#call(options) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/yj/render.rb', line 7 def call() [:locals] ||= {} [:locals].merge!(r: self, _partial: true) if [:collection].present? yaml = @context.render YAML.load(yaml).to_json end |