Class: S3WebsiteDeploy::CachePolicy::Policy
- Inherits:
-
Object
- Object
- S3WebsiteDeploy::CachePolicy::Policy
- Defined in:
- lib/s3_website_deploy/cache_policy.rb
Instance Attribute Summary collapse
-
#pattern ⇒ Object
readonly
Returns the value of attribute pattern.
-
#regexp ⇒ Object
readonly
Returns the value of attribute regexp.
-
#value ⇒ Object
readonly
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(pattern, value) ⇒ Policy
constructor
A new instance of Policy.
- #match?(path) ⇒ Boolean
Constructor Details
#initialize(pattern, value) ⇒ Policy
8 9 10 11 12 |
# File 'lib/s3_website_deploy/cache_policy.rb', line 8 def initialize(pattern, value) @pattern = pattern @regexp = Regexp.compile("\\A#{ Regexp.escape(pattern).gsub("\\*", ".*") }\\z") @value = value end |
Instance Attribute Details
#pattern ⇒ Object (readonly)
Returns the value of attribute pattern.
6 7 8 |
# File 'lib/s3_website_deploy/cache_policy.rb', line 6 def pattern @pattern end |
#regexp ⇒ Object (readonly)
Returns the value of attribute regexp.
6 7 8 |
# File 'lib/s3_website_deploy/cache_policy.rb', line 6 def regexp @regexp end |
#value ⇒ Object (readonly)
Returns the value of attribute value.
6 7 8 |
# File 'lib/s3_website_deploy/cache_policy.rb', line 6 def value @value end |
Instance Method Details
#match?(path) ⇒ Boolean
14 15 16 |
# File 'lib/s3_website_deploy/cache_policy.rb', line 14 def match?(path) regexp.match?(path) end |