Class: Yarrow::Output::Context

Inherits:
Object
  • Object
show all
Includes:
HTML::AssetTags
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.

Includes the library of helpers for dynamically generating HTML tags.

Instance Method Summary collapse

Methods included from HTML::AssetTags

#base_url_path, #link_tag, #manifest, #script_tag, #script_tags

Methods included from Configurable

#config

Constructor Details

#initialize(attributes) ⇒ Context

Returns a new instance of Context.



15
16
17
18
19
20
# File 'lib/yarrow/output/context.rb', line 15

def initialize(attributes)
  metaclass = class << self; self; end
  attributes.each do |name, value|
    metaclass.send :define_method, name, lambda { value }
  end
end