Class: Sprockets::SassCacheStore

Inherits:
Sass::CacheStores::Base
  • Object
show all
Defined in:
lib/sprockets/sass_cache_store.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(environment) ⇒ SassCacheStore

Returns a new instance of SassCacheStore


7
8
9
# File 'lib/sprockets/sass_cache_store.rb', line 7

def initialize(environment)
  @environment = environment
end

Instance Attribute Details

#environmentObject (readonly)

Returns the value of attribute environment


5
6
7
# File 'lib/sprockets/sass_cache_store.rb', line 5

def environment
  @environment
end

Instance Method Details

#_retrieve(key, version, sha) ⇒ Object


15
16
17
18
19
20
21
22
23
# File 'lib/sprockets/sass_cache_store.rb', line 15

def _retrieve(key, version, sha)
  if obj = environment.cache_get("sass/#{key}")
    return unless obj[:version] == version
    return unless obj[:sha] == sha
    obj[:contents]
  else
    nil
  end
end

#_store(key, version, sha, contents) ⇒ Object


11
12
13
# File 'lib/sprockets/sass_cache_store.rb', line 11

def _store(key, version, sha, contents)
  environment.cache_set("sass/#{key}", {:version => version, :sha => sha, :contents => contents})
end

#path_to(key) ⇒ Object


25
26
27
# File 'lib/sprockets/sass_cache_store.rb', line 25

def path_to(key)
  key
end