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}")%> <%@html.search("//img").each do |element|%> <%element.attributes.each do |key ,value|%> <%dir_name = File.dirname("#{value}")%> <%end%> <%end%> Any help would be greatly appreciated -- Posted via http://www.ruby-forum.com/. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
undefined method `each'' for> {"src"=>"Capture/12201010081441205.jpg"}:Hpricot::Attributes > > source code > > <%@a = File.read("#{@file_path}")%> > > <%@html = Hpricot.parse("#{@a}")%> > > <%@html.search("//img").each do |element|%> > > it appears there is a problem here ^, this is returning and attribute srcof 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 -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.