From: Charles Lowe Date: 2007-05-08T20:37:06+09:00 Subject: Re: Pass data to a variable Seth .. wrote: > Hello, > > I've create a simple screen scraper which sends a message to a Jabber > client for notification. The scraper portion works as does the Jabber > portion but I'm having trouble passing the data from the scraper to the > Jabber client. > > Here's what gets all the data in the scraper portion > > > link.search("//font[@class='hosts']").each do |host| > > host.to_html.match(/[a-z]+[0-9]*\.(foo|bar)\.[a-z]+/) > > end > > I then have Jabber setup as follows > > cl = Client::new(myJID, false) > cl.connect > cl.auth(myPassword) > m = Message::new(to, > body).set_type(:normal).set_id('1').set_subject(subject) > cl.send(m) > cl.close > > I somehow have to get the data into the body variable. Any ideas? Not quite sure if I understand the question, but you can pass any arbitrary ruby object as the text body by serializing it using YAML. ie: require 'yaml' body = hosts.to_yaml m = Message::new(to, body)..... -- Posted via http://www.ruby-forum.com/.