Class: Flue::ERBFilter

Inherits:
Object
  • Object
show all
Includes:
Benchmark, Logger
Defined in:
lib/flue/content_filter.rb

Constant Summary

Constants included from Logger

Logger::DEFAULT_LOGGER

Instance Method Summary collapse

Methods included from Benchmark

#benchmark

Methods included from Logger

included, #logger

Instance Method Details

#call(input, options = {}) ⇒ Object



33
34
35
36
37
38
39
40
# File 'lib/flue/content_filter.rb', line 33

def call(input, options={})
  if options[:variables]
    options[:variables].each do |name,value|
      instance_variable_set("@#{name.to_s}", value)
    end
  end
  ERB.new(input).result(binding)
end

#partial(name) ⇒ Object



42
43
44
45
46
47
# File 'lib/flue/content_filter.rb', line 42

def partial(name)
  partialfile = PartialFile.new(name)
  benchmark "#{partialfile.basename} => partial" do
    call( FilterRegister.run(partialfile.exts, partialfile.content, :partial => true) )
  end
end