Module: LinkThumbnailer

Defined in:
lib/link_thumbnailer.rb,
lib/link_thumbnailer/uri.rb,
lib/link_thumbnailer/page.rb,
lib/link_thumbnailer/model.rb,
lib/link_thumbnailer/grader.rb,
lib/link_thumbnailer/parser.rb,
lib/link_thumbnailer/railtie.rb,
lib/link_thumbnailer/scraper.rb,
lib/link_thumbnailer/version.rb,
lib/link_thumbnailer/processor.rb,
lib/link_thumbnailer/exceptions.rb,
lib/link_thumbnailer/graders/base.rb,
lib/link_thumbnailer/image_parser.rb,
lib/link_thumbnailer/models/image.rb,
lib/link_thumbnailer/models/title.rb,
lib/link_thumbnailer/models/video.rb,
lib/link_thumbnailer/video_parser.rb,
lib/link_thumbnailer/configuration.rb,
lib/link_thumbnailer/scrapers/base.rb,
lib/link_thumbnailer/graders/length.rb,
lib/link_thumbnailer/models/favicon.rb,
lib/link_thumbnailer/models/website.rb,
lib/link_thumbnailer/image_validator.rb,
lib/link_thumbnailer/graders/position.rb,
lib/link_thumbnailer/image_comparator.rb,
lib/link_thumbnailer/models/description.rb,
lib/link_thumbnailer/graders/link_density.rb,
lib/link_thumbnailer/scrapers/default/base.rb,
lib/link_thumbnailer/graders/html_attribute.rb,
lib/link_thumbnailer/image_comparators/base.rb,
lib/link_thumbnailer/image_comparators/size.rb,
lib/link_thumbnailer/scrapers/default/title.rb,
lib/link_thumbnailer/scrapers/default/images.rb,
lib/link_thumbnailer/scrapers/default/videos.rb,
lib/link_thumbnailer/scrapers/opengraph/base.rb,
lib/link_thumbnailer/scrapers/default/favicon.rb,
lib/link_thumbnailer/scrapers/opengraph/image.rb,
lib/link_thumbnailer/scrapers/opengraph/title.rb,
lib/link_thumbnailer/scrapers/opengraph/video.rb,
lib/link_thumbnailer/scrapers/opengraph/images.rb,
lib/link_thumbnailer/scrapers/opengraph/videos.rb,
lib/link_thumbnailer/scrapers/opengraph/favicon.rb,
lib/generators/link_thumbnailer/install_generator.rb,
lib/link_thumbnailer/scrapers/default/description.rb,
lib/link_thumbnailer/scrapers/opengraph/description.rb

Defined Under Namespace

Modules: Generators, Graders, ImageComparators, Models, Scrapers Classes: Configuration, Grader, ImageComparator, ImageParser, ImageValidator, Model, Page, Parser, Processor, Railtie, Scraper, URI, VideoParser

Constant Summary collapse

VERSION =
'3.2.1'
Exceptions =
Class.new(StandardError)
RedirectLimit =
Class.new(Exceptions)
BadUriFormat =
Class.new(Exceptions)
FormatNotSupported =
Class.new(Exceptions)
ScraperInvalid =
Class.new(Exceptions)
HTTPError =
Class.new(Exceptions)
SyntaxError =
Class.new(Exceptions)

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.pageObject (readonly)

Returns the value of attribute page.



11
12
13
# File 'lib/link_thumbnailer.rb', line 11

def page
  @page
end

Class Method Details

.configLinkThumbnailer::Configuration

Access point for the gem configurations.

Returns:



6
7
8
# File 'lib/link_thumbnailer/configuration.rb', line 6

def self.config
  @config ||= Configuration.new
end

.configure {|config| ... } ⇒ void

This method returns an undefined value.

Configure hook used in the gem initializer. Convinient way to set all the gem configurations.

Examples:

inside config/initializers/link_thumbnaler.rb

LinkThumbnailer.configure do |config|
  config.user_agent = 'link_thumbnailer'
end

Yields:



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

def self.configure
  yield config if block_given?
end

.generate(url, options = {}) ⇒ Object



13
14
15
16
17
# File 'lib/link_thumbnailer.rb', line 13

def generate(url, options = {})
  @page = ::LinkThumbnailer::Page.new(url, options)

  page.generate
end