Hpricot help

Greetings to all…

When i run the below code , i get the below error

undefined method `each’ for
{“src”=>“Capture/12201010081441205.jpg”}:Hpricot::Attributes

source code

<%@a = File.read("#{@file_path}")%>

<%@html = Hpricot.parse("#{@a}")%>

<[email protected]("//img").each do |element|%>

<%element.attributes.each do |key ,value|%>

  <%dir_name = File.dirname("#{value}")%>

<%end%>

<%end%>

Any help would be greatly appreciated

undefined method `each’ for

it appears there is a problem here ^, this is returning and attribute src
of the img tag and not a collection of img’s so you cant iterate over
{“src”=>“Capture/12201010081441205.jpg”},but i have never used Hpricot
so i
my be wrong

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs