Module: EZML::Filters
Defined Under Namespace
Modules: Base, Cdata, Coffee, Css, Erb, Escaped, Javascript, Less, Markdown, Plain, PrecompiledTiltFilter, Preserve, Ruby, Sass, Scss, TiltFilter
Instance Attribute Summary collapse
-
#defined ⇒ Object
readonly
Returns the value of attribute defined.
Instance Method Summary collapse
Instance Attribute Details
#defined ⇒ Object (readonly)
Returns the value of attribute defined.
8 9 10 |
# File 'lib/ezml/filters.rb', line 8 def defined @defined end |
Instance Method Details
#register_tilt_filter(name, options = {}) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/ezml/filters.rb', line 11 def register_tilt_filter(name, = {}) 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([:extend] || "Plain") filter.extend TiltFilter filter.extend PrecompiledTiltFilter if .has_key? :precompiled if .has_key? :template_class filter.template_class = [:template_class] else filter.tilt_extension = .fetch(:extension) { name.downcase } end # All ":coffeescript" as alias for ":coffee", etc. if .has_key?(:alias) [[:alias]].flatten.each {|x| Filters.defined[x.to_s] = filter} end filter end |
#remove_filter(name) ⇒ Object
34 35 36 37 38 39 |
# 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 |