Class: ImagesByUrl::ParseImagesByUrl
- Inherits:
-
Object
- Object
- ImagesByUrl::ParseImagesByUrl
- Defined in:
- lib/images_by_url.rb
Instance Method Summary collapse
Instance Method Details
#list_links_images(url) ⇒ Object
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 |