File: sass_cache_store.rb

package info (click to toggle)
ruby-sprockets 3.7.0-1%2Bdeb9u1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 544 kB
  • sloc: ruby: 4,163; makefile: 2
file content (34 lines) | stat: -rw-r--r-- 873 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
require 'sass'

module Sprockets
  class SassProcessor
    # Internal: Cache wrapper for Sprockets cache adapter.
    class CacheStore < ::Sass::CacheStores::Base
      VERSION = '1'

      def initialize(cache, version)
        @cache, @version = cache, "#{VERSION}/#{version}"
      end

      def _store(key, version, sha, contents)
        @cache.set("#{@version}/#{version}/#{key}/#{sha}", contents, true)
      end

      def _retrieve(key, version, sha)
        @cache.get("#{@version}/#{version}/#{key}/#{sha}", true)
      end

      def path_to(key)
        key
      end
    end
  end

  # Deprecated: Use Sprockets::SassProcessor::CacheStore instead.
  class SassCacheStore < SassProcessor::CacheStore
    def initialize(*args)
      Deprecation.new.warn "SassCacheStore is deprecated please use SassProcessor::CacheStore instead"
      super
    end
  end
end