Class: StaticSync::Meta::Caching
- Inherits:
-
Object
- Object
- StaticSync::Meta::Caching
- Defined in:
- lib/static_sync/meta/caching.rb
Instance Method Summary collapse
- #for(file, mime) ⇒ Object
-
#initialize(config) ⇒ Caching
constructor
A new instance of Caching.
Constructor Details
#initialize(config) ⇒ Caching
Returns a new instance of Caching.
5 6 7 |
# File 'lib/static_sync/meta/caching.rb', line 5 def initialize(config) @config = config end |
Instance Method Details
#for(file, mime) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/static_sync/meta/caching.rb', line 9 def for(file, mime) = {} type = mime.sub_type type = mime.media_type if mime.media_type == "image" if @config.cache.has_key?(type) expiry = @config.cache[type].to_i .merge!( :cache_control => "public, max-age=#{expiry}" ) end end |