YAML Library not recognized

My setup:
ruby 1.8.6 (2007-03-13 patchlevel 0) [i686-linux]

So i compiled ruby from source and installed it on my system (ubuntu
7.04), and was happy for a while. However i fired up irb one day and ran
the following command:

{}.to_yaml

and i got the following error:

NoMethodError: undefined method `to_yaml’ for {}:Hash

I then installed the yaml library from the synaptic package manager for
ruby, and restarted my system. I still keep getting the same error.

My hypothesis as to why this is happening is because when I compiled
ruby, i added the “prefix=/usr/local” flag when i ran the config file,
so it was installed to a different directory other than what synaptic
would usually install it to. However, it still doesn’t recognize the
YAML library.

I can’t seem to figure out why there is no YAML library on my version of
Ruby or how to install it. If anybody can help me out with this problem,
i’d really appreciated it.

Dnia Thu, 13 Sep 2007 01:43:21 +0900
Ahmed H. [email protected] napisaÅ‚(a):

{}.to_yaml

and i got the following error:

NoMethodError: undefined method `to_yaml’ for {}:Hash

irb(main):001:0> {}.to_yaml
NoMethodError: undefined method `to_yaml’ for {}:Hash
from (irb):1
irb(main):002:0> require ‘yaml’
=> true
irb(main):003:0> {}.to_yaml
=> “— {}\n\n”

It works on my system (Ubuntu 7.04, Ruby from package).

Hi Ahmed :slight_smile: and everyone

Is there some kind of a config option that will auto require yaml lib?
On windows
{}.to_yaml works without requiring yaml in irb

Many thanks
Eugene.