Sha256: 88a4fcc2311d2c21b1a5ec113cc2661656d7357f85e5fe4bda2901a3ef97c705

Contents?: true

Size: 467 Bytes

Versions: 1

Compression:

Stored size: 467 Bytes

Contents

module AutoHtml
  class Builder
    @@filters = {}

    def initialize(text, options = {})
      @text = text.dup
      @options = options
    end

    def self.add_filter(name, &block)
      filter = Filter.new(block)
      @@filters.merge!(name => filter)
      src = %|
        def #{name}(options = {})
          @text = @@filters["#{name}".to_sym].apply(@text, options)
        end
      |
      class_eval src, __FILE__, __LINE__
      filter
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
auto_html-whistlerbrk-2.0.0.pre lib/auto_html/builder.rb