class Roger::Template::TemplateContext

The context that is passed to all templates

Public Class Methods

new(renderer, env = {}) click to toggle source
# File lib/roger/template/template_context.rb, line 13
def initialize(renderer, env = {})
  @_renderer = renderer
  @_env = env
end

Public Instance Methods

document() click to toggle source

Access to the front-matter of the document (if any)

# File lib/roger/template/template_context.rb, line 28
def document
  @_data ||= OpenStruct.new(@_renderer.data)
end
env() click to toggle source

The current environment variables.

# File lib/roger/template/template_context.rb, line 33
def env
  @_env
end
renderer() click to toggle source
# File lib/roger/template/template_context.rb, line 18
def renderer
  @_renderer
end
template() click to toggle source

The current Roger::Template in use

# File lib/roger/template/template_context.rb, line 23
def template
  @_renderer.current_template
end