module EZML::Filters
Attributes
defined[R]
Public Instance Methods
register_tilt_filter(name, options = {})
click to toggle source
# File lib/ezml/filters.rb, line 11 def register_tilt_filter(name, options = {}) if constants.map(&:to_s).include?(name.to_s) raise "#{name} filter already defined" end filter = const_set(name, Module.new) filter.extend const_get(options[:extend] || "Plain") filter.extend TiltFilter filter.extend PrecompiledTiltFilter if options.has_key? :precompiled if options.has_key? :template_class filter.template_class = options[:template_class] else filter.tilt_extension = options.fetch(:extension) { name.downcase } end # All ":coffeescript" as alias for ":coffee", etc. if options.has_key?(:alias) [options[:alias]].flatten.each {|x| Filters.defined[x.to_s] = filter} end filter end
remove_filter(name)
click to toggle source
# File lib/ezml/filters.rb, line 34 def remove_filter(name) defined.delete name.to_s.downcase if constants.map(&:to_s).include?(name.to_s) remove_const name.to_sym end end