module Haml::Filters::TiltFilter

@private

Attributes

options[RW]
template_class[W]
tilt_extension[RW]

Public Class Methods

extended(base) click to toggle source
# File lib/haml/filters.rb, line 334
def self.extended(base)
  base.options = {}
  # There's a bug in 1.9.2 where the same parse tree cannot be shared
  # across several singleton classes -- this bug is fixed in 1.9.3.
  # We work around this by using a string eval instead of a block eval
  # so that a new parse tree is created for each singleton class.
  base.instance_eval %Q{
    include Base

    def render_with_options(text, compiler_options)
      text = template_class.new(nil, 1, options) {text}.render
      super(text, compiler_options)
    end
  }
end

Public Instance Methods

template_class() click to toggle source
# File lib/haml/filters.rb, line 324
def template_class
  (@template_class if defined? @template_class) or begin
    @template_class = Tilt["t.#{tilt_extension}"] or
      raise Error.new(Error.message(:cant_run_filter, tilt_extension))
  rescue LoadError => e
    dep = e.message.split('--').last.strip
    raise Error.new(Error.message(:gem_install_filter_deps, tilt_extension, dep))
  end
end