Class: Flue::FilterRegister
- Inherits:
-
Object
- Object
- Flue::FilterRegister
- Defined in:
- lib/flue/filter_register.rb
Constant Summary collapse
- @@filters =
{}
Class Method Summary collapse
- .filters ⇒ Object
- .register(ext, filter) ⇒ Object
- .run(exts, content, options = {}) ⇒ Object
- .run_ext(ext, content, options) ⇒ Object
Class Method Details
.filters ⇒ Object
5 6 7 |
# File 'lib/flue/filter_register.rb', line 5 def self.filters @@filters end |
.register(ext, filter) ⇒ Object
9 10 11 |
# File 'lib/flue/filter_register.rb', line 9 def self.register(ext, filter) filters[ext.to_s] = filter end |
.run(exts, content, options = {}) ⇒ Object
13 14 15 16 17 18 |
# File 'lib/flue/filter_register.rb', line 13 def self.run(exts, content, ={}) f = exts.pop return content unless f result = run_ext(f, content, ) run(exts,result, ) end |
.run_ext(ext, content, options) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/flue/filter_register.rb', line 20 def self.run_ext(ext,content, ) if filters[ext] filters[ext].new.call(content, ) else content end end |