Sha256: 606d0bb42761425d2e3b54f0e849500c64b47185a5c0f91a433eb71736f10d51

Contents?: true

Size: 420 Bytes

Versions: 27

Compression:

Stored size: 420 Bytes

Contents

module Miam
  module 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
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
miam-0.2.4 lib/miam/template_helper.rb
miam-0.2.4.beta18 lib/miam/template_helper.rb
miam-0.2.4.beta17 lib/miam/template_helper.rb
miam-0.2.4.beta16 lib/miam/template_helper.rb
miam-0.2.4.beta15 lib/miam/template_helper.rb
miam-0.2.4.beta14 lib/miam/template_helper.rb
miam-0.2.4.beta13 lib/miam/template_helper.rb
miam-0.2.4.beta12 lib/miam/template_helper.rb
miam-0.2.4.beta11 lib/miam/template_helper.rb
miam-0.2.4.beta10 lib/miam/template_helper.rb
miam-0.2.4.beta9 lib/miam/template_helper.rb
miam-0.2.4.beta8 lib/miam/template_helper.rb
miam-0.2.4.beta7 lib/miam/template_helper.rb
miam-0.2.4.beta6 lib/miam/template_helper.rb
miam-0.2.4.beta5 lib/miam/template_helper.rb
miam-0.2.4.beta4 lib/miam/template_helper.rb
miam-0.2.4.beta3 lib/miam/template_helper.rb
miam-0.2.4.beta2 lib/miam/template_helper.rb
miam-0.2.4.beta lib/miam/template_helper.rb
miam-0.2.3 lib/miam/template_helper.rb