Sha256: 57095faa840a62398e13848339da9a6c6f47993548bd0b713a11933c65f12dfa

Contents?: true

Size: 851 Bytes

Versions: 9

Compression:

Stored size: 851 Bytes

Contents

module FastHaml
  module FilterCompilers
    class NotFound < StandardError
      attr_reader

      def initialize(name)
        super("Unable to find compiler for #{name}")
        @name = name
      end
    end

    def self.compilers
      @compilers ||= {}
    end

    def self.register(name, compiler)
      compilers[name.to_s] = compiler
    end

    def self.find(name)
      name = name.to_s
      if compilers.has_key?(name.to_s)
        compilers[name].new
      else
        raise NotFound.new(name)
      end
    end
  end
end

require 'fast_haml/filter_compilers/cdata'
require 'fast_haml/filter_compilers/css'
require 'fast_haml/filter_compilers/escaped'
require 'fast_haml/filter_compilers/javascript'
require 'fast_haml/filter_compilers/plain'
require 'fast_haml/filter_compilers/preserve'
require 'fast_haml/filter_compilers/ruby'

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fast_haml-0.1.8 lib/fast_haml/filter_compilers.rb
fast_haml-0.1.7 lib/fast_haml/filter_compilers.rb
fast_haml-0.1.6 lib/fast_haml/filter_compilers.rb
fast_haml-0.1.5 lib/fast_haml/filter_compilers.rb
fast_haml-0.1.4 lib/fast_haml/filter_compilers.rb
fast_haml-0.1.3 lib/fast_haml/filter_compilers.rb
fast_haml-0.1.2 lib/fast_haml/filter_compilers.rb
fast_haml-0.1.1 lib/fast_haml/filter_compilers.rb
fast_haml-0.1.0 lib/fast_haml/filter_compilers.rb