Module: Middleman::S3Sync::CachingPolicy

Included in:
Middleman::S3Sync
Defined in:
lib/middleman/s3_sync/caching_policy.rb

Instance Method Summary collapse

Instance Method Details

#add_caching_policy(content_type, options) ⇒ Object



6
7
8
# File 'lib/middleman/s3_sync/caching_policy.rb', line 6

def add_caching_policy(content_type, options)
  caching_policies[content_type.to_s] = BrowserCachePolicy.new(options)
end

#caching_policiesObject



19
20
21
# File 'lib/middleman/s3_sync/caching_policy.rb', line 19

def caching_policies
  @caching_policies ||= Map.new
end

#caching_policy_for(content_type) ⇒ Object



10
11
12
13
# File 'lib/middleman/s3_sync/caching_policy.rb', line 10

def caching_policy_for(content_type)
  return default_caching_policy if content_type.nil? || content_type.empty?
  caching_policies.fetch(content_type.to_s.split(';').first.strip, caching_policies[:default])
end

#default_caching_policyObject



15
16
17
# File 'lib/middleman/s3_sync/caching_policy.rb', line 15

def default_caching_policy
  caching_policies[:default]
end