Class: LinkThumbnailer::ImageValidator

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(image) ⇒ ImageValidator

Returns a new instance of ImageValidator.



8
9
10
11
12
13
# File 'lib/link_thumbnailer/image_validator.rb', line 8

def initialize(image)
  @config = ::LinkThumbnailer.page.config
  @image  = image

  super(config)
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



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

def config
  @config
end

#imageObject (readonly)

Returns the value of attribute image.



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

def image
  @image
end

Instance Method Details

#callObject



15
16
17
18
19
20
21
# File 'lib/link_thumbnailer/image_validator.rb', line 15

def call
  blacklist_urls.each do |url|
    return false if image.src && image.src.to_s[url]
  end

  true
end