Class: S3WebsiteDeploy::CachePolicy
- Inherits:
-
Object
- Object
- S3WebsiteDeploy::CachePolicy
- Defined in:
- lib/s3_website_deploy/cache_policy.rb
Defined Under Namespace
Classes: Policy
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#policies ⇒ Object
readonly
Returns the value of attribute policies.
Instance Method Summary collapse
- #cache_control(path) ⇒ Object
-
#initialize(config) ⇒ CachePolicy
constructor
A new instance of CachePolicy.
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
#config ⇒ Object (readonly)
Returns the value of attribute config.
3 4 5 |
# File 'lib/s3_website_deploy/cache_policy.rb', line 3 def config @config end |
#policies ⇒ Object (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 |