Class: S3WebsiteDeploy::CachePolicy::Policy

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

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#patternObject (readonly)

Returns the value of attribute pattern.



6
7
8
# File 'lib/s3_website_deploy/cache_policy.rb', line 6

def pattern
  @pattern
end

#regexpObject (readonly)

Returns the value of attribute regexp.



6
7
8
# File 'lib/s3_website_deploy/cache_policy.rb', line 6

def regexp
  @regexp
end

#valueObject (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