Class: UrlInfoExtractor

Inherits:
Object
  • Object
show all
Includes:
Favicon
Defined in:
lib/url_info_extractor.rb,
lib/url_info_extractor/favicon.rb,
lib/url_info_extractor/version.rb

Defined Under Namespace

Modules: Favicon Classes: SchemeNotSupported

Constant Summary collapse

VERSION =
"0.0.2"

Instance Method Summary collapse

Methods included from Favicon

#favicon_exists?, #favicon_url

Constructor Details

#initialize(url) ⇒ UrlInfoExtractor

Returns a new instance of UrlInfoExtractor.



14
15
16
17
18
# File 'lib/url_info_extractor.rb', line 14

def initialize(url)
  @uri = URI.parse(url)
  @path = @uri.path
  @path = '/' if @path.empty?
end

Instance Method Details

#descriptionObject



23
24
25
# File 'lib/url_info_extractor.rb', line 23

def description
  fetched_data[:description]
end

#scheme_supported?Boolean

Returns:

  • (Boolean)


27
28
29
# File 'lib/url_info_extractor.rb', line 27

def scheme_supported?
  %w(http https).include? @uri.scheme
end

#titleObject



19
20
21
# File 'lib/url_info_extractor.rb', line 19

def title
  fetched_data[:title]
end