require 'yaml' fails

B

Bucco

I am testing a program:

require 'yaml'
array = [1, 2, 3, [4, "five", :six]]
puts "Original array:"
puts array.inspect
yarray = array.to_yaml
puts "YAML representation of array: "
puts yarray
thawed = YAML.load(yarray)
puts "Array re-loaded from YAML string: "
p thawed

When I run this in radrails I get the following errors:
Original array:
[1, 2, 3, [4, "five", :six]]
C:\Documents and Settings\sarmstrong\My
Documents\sandbox\yaml/yaml.rb:5: undefined method `to_yaml' for [1, 2,
3, [4, "five", :six]]:Array (NoMethodError)
from C:/ruby/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:21:in
`require'
from C:/Documents and Settings/sarmstrong/My
Documents/sandbox/yaml/yaml.rb:1

When I run the program in the cmd with ruby testfile.rb, the program
works like it is suposed to. I am running radrails on Windows XP.
Anyone know what may be causing the issue?

Thanks:)
SA
 
B

Bucco

I am not sure what I did, but when I deleted the file and started over,
it began to work correctly for rad rails.

Don't really understand what happened, but it is working now. If
anyone has any ideas, let me know.

Thanks:)

SA
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,777
Messages
2,569,604
Members
45,234
Latest member
SkyeWeems

Latest Threads

Top