Sha256: 0a434d061048cdf7d91861d17bf8726f0a97c275741267de86541cea7c0c5514

Contents?: true

Size: 420 Bytes

Versions: 15

Compression:

Stored size: 420 Bytes

Contents

module Dyna
  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

15 entries across 15 versions & 1 rubygems

Version Path
dyna-0.2.3 lib/dyna/template_helper.rb
dyna-0.2.2 lib/dyna/template_helper.rb
dyna-0.2.1 lib/dyna/template_helper.rb
dyna-0.2.1.beta2 lib/dyna/template_helper.rb
dyna-0.2.1.beta1 lib/dyna/template_helper.rb
dyna-0.2.0 lib/dyna/template_helper.rb
dyna-0.1.9 lib/dyna/template_helper.rb
dyna-0.1.8 lib/dyna/template_helper.rb
dyna-0.1.7 lib/dyna/template_helper.rb
dyna-0.1.6 lib/dyna/template_helper.rb
dyna-0.1.5 lib/dyna/template_helper.rb
dyna-0.1.4 lib/dyna/template_helper.rb
dyna-0.1.3 lib/dyna/template_helper.rb
dyna-0.1.2 lib/dyna/template_helper.rb
dyna-0.1.1 lib/dyna/template_helper.rb