Class: GitHubPages::HealthCheck::CDN

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/github-pages-health-check/cdn.rb

Direct Known Subclasses

CloudFlare, Fastly

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ CDN

Internal: Create a new CDN info instance.



16
17
18
19
# File 'lib/github-pages-health-check/cdn.rb', line 16

def initialize(options = {})
  @name = options.fetch(:name) { self.class.name.split("::").last.downcase }
  @path = options.fetch(:path) { default_config_path }
end

Instance Attribute Details

#nameObject (readonly)

Internal: The path of the config file.



8
9
10
# File 'lib/github-pages-health-check/cdn.rb', line 8

def name
  @name
end

#pathObject (readonly)

Internal: The path of the config file.



8
9
10
# File 'lib/github-pages-health-check/cdn.rb', line 8

def path
  @path
end

Class Method Details

.controls_ip?(address) ⇒ Boolean

Public: Does cloudflare control this address?

Returns:

  • (Boolean)


11
12
13
# File 'lib/github-pages-health-check/cdn.rb', line 11

def self.controls_ip?(address)
  instance.controls_ip?(address)
end

Instance Method Details

#controls_ip?(address) ⇒ Boolean

Internal: Does this CDN control this address?

Returns:

  • (Boolean)


22
23
24
# File 'lib/github-pages-health-check/cdn.rb', line 22

def controls_ip?(address)
  ranges.any? { |range| range.include?(address) }
end