Sha256: 17d6773ca411a342346bf5e6f192af2f34e5b63febd07a6b37f4e2f322f6cbc2

Contents?: true

Size: 386 Bytes

Versions: 8

Compression:

Stored size: 386 Bytes

Contents

module Radiosonde::TemplateHelper
  def include_template(template_name, context = {})
    tmplt = @context.templates[template_name.to_s]

    unless tmplt
      raise "Template `#{template_name}` is not defined"
    end

    context_orig = @context
    @context = @context.merge(context)
    instance_eval(&tmplt)
    @context = context_orig
  end

  def context
    @context
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
radiosonde-0.2.0.beta5 lib/radiosonde/template_helper.rb
radiosonde-0.2.0.beta4 lib/radiosonde/template_helper.rb
radiosonde-0.2.0.beta3 lib/radiosonde/template_helper.rb
radiosonde-0.2.0.beta2 lib/radiosonde/template_helper.rb
radiosonde-0.2.0.beta lib/radiosonde/template_helper.rb
radiosonde-0.1.1 lib/radiosonde/template_helper.rb
radiosonde-0.1.0 lib/radiosonde/template_helper.rb
radiosonde-0.0.8 lib/radiosonde/template_helper.rb