Sha256: 75c30e51e64ba1204dc52396283b0aaaf30c2a3cd9a5f497f0d947cf977bcc54

Contents?: true

Size: 429 Bytes

Versions: 10

Compression:

Stored size: 429 Bytes

Contents

module Simnos
  module TemplateHelper
    def include_template(template_name, context = {})
      template = @context.templates[template_name.to_s]

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

      context_org = @context
      @context = @context.merge(context)
      instance_eval(&template)
      @context = context_org
    end

    def context
      @context
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
simnos-0.1.3.beta1 lib/simnos/template_helper.rb
simnos-0.1.2 lib/simnos/template_helper.rb
simnos-0.1.1 lib/simnos/template_helper.rb
simnos-0.1.1.beta2 lib/simnos/template_helper.rb
simnos-0.1.1.beta1 lib/simnos/template_helper.rb
simnos-0.1.0 lib/simnos/template_helper.rb
simnos-0.1.0.beta4 lib/simnos/template_helper.rb
simnos-0.1.0.beta3 lib/simnos/template_helper.rb
simnos-0.1.0.beta2 lib/simnos/template_helper.rb
simnos-0.1.0.beta1 lib/simnos/template_helper.rb