Sha256: dd0d2b6def2b51f0f948918157ec7afd4555be941f56ebb517cb79dfe29f372d

Contents?: true

Size: 429 Bytes

Versions: 6

Compression:

Stored size: 429 Bytes

Contents

module AutoHtml
  class Builder

    @@filters = {}

    def initialize(text)
      @text = text.dup
    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

6 entries across 6 versions & 2 rubygems

Version Path
dejan-auto_html-1.1.0 lib/auto_html/builder.rb
dejan-auto_html-1.1.1 lib/auto_html/builder.rb
dejan-auto_html-1.1.2 lib/auto_html/builder.rb
dejan-auto_html-1.2.0 lib/auto_html/builder.rb
auto_html-1.2.1 lib/auto_html/builder.rb
auto_html-1.2.0 lib/auto_html/builder.rb