Class: ImagesByUrl::ParseImagesByUrl

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

Instance Method Summary collapse

Instance Method Details



9
10
11
12
13
14
15
16
17
18
19
20
# File 'lib/images_by_url.rb', line 9

def list_links_images(url)
  html = open(url)
  doc = Nokogiri::HTML(html)
  showings = []
  doc.css('img').each do |showing|
    img = showing.attr('src')
    showings.push(
       link: img
    )
  end
  JSON.pretty_generate(showings)
end