[LRUG] problems with YAML
Andrew Stewart
boss at airbladesoftware.com
Thu Feb 28 08:06:01 PST 2008
On 28 Feb 2008, at 15:47, aidy lewis wrote:
> The trouble I am having is that the hash within the #register method
> isnil after it is invoked.
Does this do what you want?
require 'yaml'
yaml = <<END
test: tiscali
url: http://tiscali3-test.vizumi.com/
register:
first_name: aidy
surname: smith
email: 'testautomated6 at googlemail.com'
password: password
registration: KJHDF123
END
class SmokeTest
attr_accessor :test, :url, :register
def initialize test, url, register
@test = test
@url = url
@register = register
end
end
obj = YAML.load yaml
smoke_test = SmokeTest.new obj['test'], obj['url'], obj['register']
%w( test url register ).each do |method|
puts "#{method}: #{smoke_test.send(method).inspect}"
end
Regards,
Andy Stewart
-------
http://airbladesoftware.com
More information about the Chat
mailing list