Class: Guillotine::StringHostChecker

Inherits:
HostChecker show all
Defined in:
lib/guillotine/host_checkers.rb

Instance Attribute Summary collapse

Attributes inherited from HostChecker

#error

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from HostChecker

all, #call, #error_response, matching

Constructor Details

#initialize(host) ⇒ StringHostChecker

Returns a new instance of StringHostChecker.



58
59
60
61
62
# File 'lib/guillotine/host_checkers.rb', line 58

def initialize(host)
  @error = "URL must be from #{host}"
  @host = host
  super
end

Instance Attribute Details

#hostObject (readonly)

Returns the value of attribute host.



56
57
58
# File 'lib/guillotine/host_checkers.rb', line 56

def host
  @host
end

Class Method Details

.match?(arg) ⇒ Boolean

Returns:

  • (Boolean)


52
53
54
# File 'lib/guillotine/host_checkers.rb', line 52

def self.match?(arg)
  arg.is_a?(String)
end

Instance Method Details

#valid?(url) ⇒ Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/guillotine/host_checkers.rb', line 64

def valid?(url)
  url.host == @host
end