Sha256: 68396f68dee32e7532c0ec3f40328596e773cf4bb1a67fe99e4449249cf03ab8
Contents?: true
Size: 589 Bytes
Versions: 4
Compression:
Stored size: 589 Bytes
Contents
module Nanoc::Filter::ERB class ERBContext def initialize(hash) hash.each_pair do |key, value| instance_variable_set('@' + key.to_s, value) end end def get_binding binding end end class ERBFilter < Nanoc::Filter identifiers :erb, :eruby def run(content) nanoc_require 'erb' # Create context assigns = { :page => @page, :pages => @pages, :config => @config, :site => @site } context = ERBContext.new(assigns) # Get result ::ERB.new(content).result(context.get_binding) end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
nanoc-2.0.2 | lib/nanoc/filters/erb.rb |
nanoc-2.0 | lib/nanoc/filters/erb.rb |
nanoc-2.0.1 | lib/nanoc/filters/erb.rb |
nanoc-2.0.3 | lib/nanoc/filters/erb.rb |