Sha256: 469131200d12fb7ef3efd93c363331eaffc83bbb0e5aa15305adb5d121caa094

Contents?: true

Size: 382 Bytes

Versions: 14

Compression:

Stored size: 382 Bytes

Contents

module Posgra::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

14 entries across 14 versions & 1 rubygems

Version Path
posgra-0.2.3.beta lib/posgra/template.rb
posgra-0.2.2 lib/posgra/template.rb
posgra-0.2.1 lib/posgra/template.rb
posgra-0.2.0 lib/posgra/template.rb
posgra-0.1.9 lib/posgra/template.rb
posgra-0.1.8 lib/posgra/template.rb
posgra-0.1.7 lib/posgra/template.rb
posgra-0.1.6 lib/posgra/template.rb
posgra-0.1.5 lib/posgra/template.rb
posgra-0.1.4 lib/posgra/template.rb
posgra-0.1.3 lib/posgra/template.rb
posgra-0.1.2 lib/posgra/template.rb
posgra-0.1.1 lib/posgra/template.rb
posgra-0.1.0 lib/posgra/template.rb