Class: BrowserCrawler::EngineUtilities::LinkInspector
- Inherits:
-
Object
- Object
- BrowserCrawler::EngineUtilities::LinkInspector
- Defined in:
- lib/browser_crawler/engine_utilities/link_inspector.rb
Instance Attribute Summary collapse
-
#host_name ⇒ Object
readonly
Returns the value of attribute host_name.
-
#raw_link ⇒ Object
readonly
Returns the value of attribute raw_link.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #external_url? ⇒ Boolean
- #full_url ⇒ Object
-
#initialize(raw_link:, host_name:) ⇒ LinkInspector
constructor
A new instance of LinkInspector.
- #internal_url? ⇒ Boolean
- #link_valid? ⇒ Boolean
Constructor Details
#initialize(raw_link:, host_name:) ⇒ LinkInspector
Returns a new instance of LinkInspector.
8 9 10 11 12 |
# File 'lib/browser_crawler/engine_utilities/link_inspector.rb', line 8 def initialize(raw_link:, host_name:) @raw_link = raw_link @host_name = host_name @uri = UrlTools.uri(url: raw_link) end |
Instance Attribute Details
#host_name ⇒ Object (readonly)
Returns the value of attribute host_name.
6 7 8 |
# File 'lib/browser_crawler/engine_utilities/link_inspector.rb', line 6 def host_name @host_name end |
#raw_link ⇒ Object (readonly)
Returns the value of attribute raw_link.
6 7 8 |
# File 'lib/browser_crawler/engine_utilities/link_inspector.rb', line 6 def raw_link @raw_link end |
#uri ⇒ Object (readonly)
Returns the value of attribute uri.
6 7 8 |
# File 'lib/browser_crawler/engine_utilities/link_inspector.rb', line 6 def uri @uri end |
Instance Method Details
#external_url? ⇒ Boolean
14 15 16 |
# File 'lib/browser_crawler/engine_utilities/link_inspector.rb', line 14 def external_url? !internal_url? end |
#full_url ⇒ Object
26 27 28 |
# File 'lib/browser_crawler/engine_utilities/link_inspector.rb', line 26 def full_url @full_url ||= UrlTools.full_url(uri: uri) end |
#internal_url? ⇒ Boolean
22 23 24 |
# File 'lib/browser_crawler/engine_utilities/link_inspector.rb', line 22 def internal_url? @internal_url ||= !uri.nil? && uri.host == host_name end |
#link_valid? ⇒ Boolean
18 19 20 |
# File 'lib/browser_crawler/engine_utilities/link_inspector.rb', line 18 def link_valid? @link_valid ||= !uri.nil? && uri.host && uri.scheme end |