Sha256: d9cd66b73c00dc4c2a34f88947e5bdcb0ac59d98f972956e56be8300cd2c0371

Contents?: true

Size: 406 Bytes

Versions: 4

Compression:

Stored size: 406 Bytes

Contents

module AutoHtml
  class Filter
    def initialize(block)
      @block = block
      @options = nil
    end

    def with(options, &block)
      @options = options
      @block = block
    end

    def apply(text, options = {})
      _options = @options && @options.merge(options)
      if _options
        @block.call(text.dup, _options)
      else
        @block.call(text.dup)
      end
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
auto_html-1.3.3 lib/auto_html/filter.rb
auto_html-1.3.2 lib/auto_html/filter.rb
auto_html-1.3.1 lib/auto_html/filter.rb
auto_html-1.3.0 lib/auto_html/filter.rb