Class: LinkThumbnailer::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/link_thumbnailer/configuration.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeLinkThumbnailer::Configuration

Create a new instance.



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
# File 'lib/link_thumbnailer/configuration.rb', line 33

def initialize
  @redirect_limit         = 3
  @user_agent             = 'link_thumbnailer'
  @verify_ssl             = true
  @http_timeout           = 5
  @blacklist_urls         = [
    %r{^http://ad\.doubleclick\.net/},
    %r{^http://b\.scorecardresearch\.com/},
    %r{^http://pixel\.quantserve\.com/},
    %r{^http://s7\.addthis\.com/}
  ]
  @attributes             = [:title, :images, :description, :videos]
  @graders                = [
    ->(description) { ::LinkThumbnailer::Graders::Length.new(description) },
    ->(description) { ::LinkThumbnailer::Graders::HtmlAttribute.new(description, :class) },
    ->(description) { ::LinkThumbnailer::Graders::HtmlAttribute.new(description, :id) },
    ->(description) { ::LinkThumbnailer::Graders::Position.new(description) },
    ->(description) { ::LinkThumbnailer::Graders::LinkDensity.new(description) }
  ]
  @description_min_length = 25
  @positive_regex = /article|body|content|entry|hentry|main|page|pagination|post|text|blog|story/i
  @negative_regex = /combx|comment|com-|contact|foot|footer|footnote|masthead|media|meta|outbrain|promo|related|scroll|shoutbox|sidebar|sponsor|shopping|tags|tool|widget|modal/i
  @image_limit    = 5
  @image_stats    = true
end

Instance Attribute Details

#attributesObject

Returns the value of attribute attributes.



25
26
27
# File 'lib/link_thumbnailer/configuration.rb', line 25

def attributes
  @attributes
end

#blacklist_urlsObject

Returns the value of attribute blacklist_urls.



25
26
27
# File 'lib/link_thumbnailer/configuration.rb', line 25

def blacklist_urls
  @blacklist_urls
end

#description_min_lengthObject

Returns the value of attribute description_min_length.



25
26
27
# File 'lib/link_thumbnailer/configuration.rb', line 25

def description_min_length
  @description_min_length
end

#gradersObject

Returns the value of attribute graders.



25
26
27
# File 'lib/link_thumbnailer/configuration.rb', line 25

def graders
  @graders
end

#http_timeoutObject

Returns the value of attribute http_timeout.



25
26
27
# File 'lib/link_thumbnailer/configuration.rb', line 25

def http_timeout
  @http_timeout
end

#image_limitObject

Returns the value of attribute image_limit.



25
26
27
# File 'lib/link_thumbnailer/configuration.rb', line 25

def image_limit
  @image_limit
end

#image_statsObject

Returns the value of attribute image_stats.



25
26
27
# File 'lib/link_thumbnailer/configuration.rb', line 25

def image_stats
  @image_stats
end

#negative_regexObject

Returns the value of attribute negative_regex.



25
26
27
# File 'lib/link_thumbnailer/configuration.rb', line 25

def negative_regex
  @negative_regex
end

#positive_regexObject

Returns the value of attribute positive_regex.



25
26
27
# File 'lib/link_thumbnailer/configuration.rb', line 25

def positive_regex
  @positive_regex
end

#redirect_limitObject

Returns the value of attribute redirect_limit.



25
26
27
# File 'lib/link_thumbnailer/configuration.rb', line 25

def redirect_limit
  @redirect_limit
end

#user_agentObject

Returns the value of attribute user_agent.



25
26
27
# File 'lib/link_thumbnailer/configuration.rb', line 25

def user_agent
  @user_agent
end

#verify_sslObject

Returns the value of attribute verify_ssl.



25
26
27
# File 'lib/link_thumbnailer/configuration.rb', line 25

def verify_ssl
  @verify_ssl
end