Class: Yarrow::Output::Context
- Inherits:
-
Object
- Object
- Yarrow::Output::Context
- Defined in:
- lib/yarrow/output/context.rb
Overview
Provides a data context for rendering a template.
Methods provided by this class become available as named variables in Mustache templates.
Instance Method Summary collapse
-
#initialize(attributes) ⇒ Context
constructor
A new instance of Context.
Constructor Details
#initialize(attributes) ⇒ Context
Returns a new instance of Context.
8 9 10 11 12 13 |
# File 'lib/yarrow/output/context.rb', line 8 def initialize(attributes) = class << self; self; end attributes.each do |name, value| .send :define_method, name, lambda { value } end end |