Class: AutoHtml::Filter
- Inherits:
-
Object
- Object
- AutoHtml::Filter
- Defined in:
- lib/auto_html/filter.rb
Instance Method Summary collapse
- #apply(text, options = {}) ⇒ Object
-
#initialize(block) ⇒ Filter
constructor
A new instance of Filter.
- #with(options, &block) ⇒ Object
Constructor Details
#initialize(block) ⇒ Filter
Returns a new instance of Filter.
4 5 6 7 |
# File 'lib/auto_html/filter.rb', line 4 def initialize(block) @block = block = nil end |
Instance Method Details
#apply(text, options = {}) ⇒ Object
14 15 16 17 18 19 20 21 |
# File 'lib/auto_html/filter.rb', line 14 def apply(text, = {}) = && .merge() if @block.call(text.dup, ) else @block.call(text.dup) end end |
#with(options, &block) ⇒ Object
9 10 11 12 |
# File 'lib/auto_html/filter.rb', line 9 def with(, &block) = @block = block end |