class Haml::Filters
def compile(node)
def compile(node) node.value[:text] ||= '' find_compiler(node).compile(node) end
def find_compiler(node)
def find_compiler(node) name = node.value[:name].to_sym compiler = Filters.registered[name] raise FilterNotFound.new("FilterCompiler for '#{name}' was not found", node.line.to_i - 1) unless compiler @compilers[name] ||= compiler.new(@options) end
def initialize(options = {})
def initialize(options = {}) @options = options @compilers = {} end
def register(name, compiler)
def register(name, compiler) registered[name] = compiler end
def remove_filter(name)
def remove_filter(name) registered.delete(name.to_s.downcase.to_sym) if constants.map(&:to_s).include?(name.to_s) remove_const name.to_sym end end