Class: Bulbasaur::ExtractImagesFromHTML

Inherits:
Object
  • Object
show all
Defined in:
lib/bulbasaur/extracts/extract_images_from_html.rb

Constant Summary collapse

CSS_IMPORT_URL_REGEX =
/(?<=url\()['"]?.+?['"]?.+?(?=\))/
IMG_CANDIDATE_URL_REGEX =
/https?:\/\/\S*\.(?:png|jpg|jpeg|gif)[(?:|~\w)]*(?!\.\S)/i

Instance Method Summary collapse

Constructor Details

#initialize(html) ⇒ ExtractImagesFromHTML

Returns a new instance of ExtractImagesFromHTML.



8
9
10
# File 'lib/bulbasaur/extracts/extract_images_from_html.rb', line 8

def initialize(html)
  @html = html
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
# File 'lib/bulbasaur/extracts/extract_images_from_html.rb', line 12

def call
  images = Array.new
  images = images + extract_images_by_tag_image
  images = images + extract_images_by_tag_style
  images = images + extract_images_by_link
  images
end