Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
problem with .each do
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="Lady Michelle Bhaal, post: 4493108"] Hiya. The book does things this way, so why doesn't it work for me? What's going on? def fromWeb(site, url) # get data from website h = Net::HTTP.new(site, 80) resp, data=h.get(url, nil) # process data data.each do <- point of second error |line| if /DGM_navigation/ =~ line do # decode page lineage step=Array.new astep, line = getNextWord(line) while astep != nil step.push(astep) astep, line = getNextWord(line) end puts "Page Lineage" step.each do |astep| step.each do put " " end puts astep end end # end DGM_naviation end # end data.each <- gets "undefined method 'line'", from the second error point above end # end def fromWeb def getNextWord(line) i1 = />\w+</ =~ line string_wanted=$&[1..$&.length-1] string_remaining=$' return string_wanted, string_remaining end [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
problem with .each do
Top