Sha256: 6cb845844561bfea08c485d06090f3dd38a153dafa41e40b9a5fa36fc97bcb82

Contents?: true

Size: 383 Bytes

Versions: 8

Compression:

Stored size: 383 Bytes

Contents

module Barkdog::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
barkdog-0.1.9 lib/barkdog/template_helper.rb
barkdog-0.1.8 lib/barkdog/template_helper.rb
barkdog-0.1.7 lib/barkdog/template_helper.rb
barkdog-0.1.6 lib/barkdog/template_helper.rb
barkdog-0.1.5 lib/barkdog/template_helper.rb
barkdog-0.1.4 lib/barkdog/template_helper.rb
barkdog-0.1.3 lib/barkdog/template_helper.rb
barkdog-0.1.3.beta lib/barkdog/template_helper.rb