Class: LinkThumbnailer::Configuration
- Inherits:
-
Object
- Object
- LinkThumbnailer::Configuration
- Defined in:
- lib/link_thumbnailer/configuration.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
Returns the value of attribute attributes.
-
#blacklist_urls ⇒ Object
Returns the value of attribute blacklist_urls.
-
#description_min_length ⇒ Object
Returns the value of attribute description_min_length.
-
#graders ⇒ Object
Returns the value of attribute graders.
-
#http_timeout ⇒ Object
Returns the value of attribute http_timeout.
-
#image_limit ⇒ Object
Returns the value of attribute image_limit.
-
#image_stats ⇒ Object
Returns the value of attribute image_stats.
-
#negative_regex ⇒ Object
Returns the value of attribute negative_regex.
-
#positive_regex ⇒ Object
Returns the value of attribute positive_regex.
-
#redirect_limit ⇒ Object
Returns the value of attribute redirect_limit.
-
#user_agent ⇒ Object
Returns the value of attribute user_agent.
-
#verify_ssl ⇒ Object
Returns the value of attribute verify_ssl.
Instance Method Summary collapse
-
#initialize ⇒ LinkThumbnailer::Configuration
constructor
Create a new instance.
Constructor Details
#initialize ⇒ LinkThumbnailer::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
#attributes ⇒ Object
Returns the value of attribute attributes.
25 26 27 |
# File 'lib/link_thumbnailer/configuration.rb', line 25 def attributes @attributes end |
#blacklist_urls ⇒ Object
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_length ⇒ Object
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 |
#graders ⇒ Object
Returns the value of attribute graders.
25 26 27 |
# File 'lib/link_thumbnailer/configuration.rb', line 25 def graders @graders end |
#http_timeout ⇒ Object
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_limit ⇒ Object
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_stats ⇒ Object
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_regex ⇒ Object
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_regex ⇒ Object
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_limit ⇒ Object
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_agent ⇒ Object
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_ssl ⇒ Object
Returns the value of attribute verify_ssl.
25 26 27 |
# File 'lib/link_thumbnailer/configuration.rb', line 25 def verify_ssl @verify_ssl end |