Class: Guillotine::StringHostChecker
- Inherits:
-
HostChecker
- Object
- HostChecker
- Guillotine::StringHostChecker
- Defined in:
- lib/guillotine/host_checkers.rb
Instance Attribute Summary collapse
-
#host ⇒ Object
readonly
Returns the value of attribute host.
Attributes inherited from HostChecker
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(host) ⇒ StringHostChecker
constructor
A new instance of StringHostChecker.
- #valid?(url) ⇒ Boolean
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
#host ⇒ Object (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
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
64 65 66 |
# File 'lib/guillotine/host_checkers.rb', line 64 def valid?(url) url.host == @host end |