Sha256: e3750034d90623b0ab7968d78414678826aac63b49808a8e84d923d3ec468c62

Contents?: true

Size: 989 Bytes

Versions: 2

Compression:

Stored size: 989 Bytes

Contents

require 'sprockets'
require 'angular/ngt/haml'

module Angular
  module NGT
    def self.configure
      yield config
    end


    def self.config
      @config ||= Configuration.new
    end


    def self.reset_config!
      config.reset!
    end


    class Configuration
      attr_accessor :module_name

      def cache_id(&block)
        if block
          @cache_id = block
        else
          @cache_id
        end
      end

      def reset!
        @cache_id = @module_name = nil
      end

      def method_missing(config_name, *)
        puts "Sorry, there is no such configuration option named #{config_name}"
        super
      end

      def init_sprockets
        # hack around bug in rails assets debug mode
        # TODO: remove this once this bug is resolved: https://github.com/sstephenson/sprockets/issues/478
        Sprockets.register_engine '.haml', Angular::NGT::Haml
        Sprockets.register_engine '.ngt', Angular::NGT::Engine
      end
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
angular-ngt-0.2.0 lib/angular/ngt/configuration.rb
angular-ngt-0.1.0 lib/angular/ngt/configuration.rb