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