Sha256: 02b0d01c387d158d78c1e2100db299df18a4b21d7fa97ff50f1ec8aa90cc658f

Contents?: true

Size: 664 Bytes

Versions: 5

Compression:

Stored size: 664 Bytes

Contents

require 'sprockets/manifest'

module Alula
  class Manifest < Sprockets::Manifest
    attr_accessor :progress
    
    def assets_with_tracking
      @_assets ||= AssetTracker.new assets_without_tracking, @progress
    end
    alias_method :assets_without_tracking, :assets
    alias_method :assets, :assets_with_tracking
    
    private
    class AssetTracker
      def initialize(hash, progress_callback)
        @hash = hash
        @progress_cb = progress_callback
      end
      
      def [](key)
        @hash[key]
      end
      
      def []=(key, value)
        @hash[key] = value
        @progress_cb.call if @progress_cb
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
alula-0.4.3 lib/alula/core_ext/manifest.rb
alula-0.4.2 lib/alula/core_ext/manifest.rb
alula-0.4.1 lib/alula/core_ext/manifest.rb
alula-0.4.0 lib/alula/core_ext/manifest.rb
alula-0.4.0b lib/alula/core_ext/manifest.rb