Sha256: 7a9fd04eb41f98b8eb8570aaf2d8abe0147ebf5ca7b04ca6339b71521f23ad93

Contents?: true

Size: 428 Bytes

Versions: 24

Compression:

Stored size: 428 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

24 entries across 24 versions & 2 rubygems

Version Path
auto_html-1.6.4 lib/auto_html/builder.rb
auto_html-1.6.3 lib/auto_html/builder.rb
auto_html-1.5.1.1 lib/auto_html/builder.rb
auto_html-1.6.2 lib/auto_html/builder.rb
auto_html-1.6.1 lib/auto_html/builder.rb
auto_html-1.6.0 lib/auto_html/builder.rb
auto_html-1.5.3 lib/auto_html/builder.rb
auto_html-1.5.2 lib/auto_html/builder.rb
auto_html-1.5.1 lib/auto_html/builder.rb
auto_html-1.5.0 lib/auto_html/builder.rb
marcosinger-auto_html-1.3.6 lib/auto_html/builder.rb
auto_html-1.4.2 lib/auto_html/builder.rb
auto_html-1.4.1 lib/auto_html/builder.rb
auto_html-1.4.0 lib/auto_html/builder.rb
auto_html-1.3.7 lib/auto_html/builder.rb
marcosinger-auto_html-1.3.5 lib/auto_html/builder.rb
marcosinger-auto_html-1.3.4 lib/auto_html/builder.rb
auto_html-1.3.6 lib/auto_html/builder.rb
auto_html-1.3.5 lib/auto_html/builder.rb
auto_html-1.3.4 lib/auto_html/builder.rb