Sha256: 27fff0030bf92b9d2eafa5b118aa80ebfc3bda811bc7c70b12f81cc255d64c44

Contents?: true

Size: 425 Bytes

Versions: 1

Compression:

Stored size: 425 Bytes

Contents

# encoding: utf-8
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

1 entries across 1 versions & 1 rubygems

Version Path
galetahub-auto_html-1.0.1 lib/auto_html/filter.rb