Class: S3WebsiteDeploy::CachePolicy

Inherits:
Object
  • Object
show all
Defined in:
lib/s3_website_deploy/cache_policy.rb

Defined Under Namespace

Classes: Policy

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ CachePolicy

Returns a new instance of CachePolicy.



19
20
21
# File 'lib/s3_website_deploy/cache_policy.rb', line 19

def initialize(config)
  @policies = config.map {|pattern, value| Policy.new(pattern, value) }
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



3
4
5
# File 'lib/s3_website_deploy/cache_policy.rb', line 3

def config
  @config
end

#policiesObject (readonly)

Returns the value of attribute policies.



3
4
5
# File 'lib/s3_website_deploy/cache_policy.rb', line 3

def policies
  @policies
end

Instance Method Details

#cache_control(path) ⇒ Object



23
24
25
26
27
# File 'lib/s3_website_deploy/cache_policy.rb', line 23

def cache_control(path)
  policy = @policies.find{|policy| policy.match?(path) }
  return unless policy
  policy.value["cache_control"]
end