# Yaml issues

**URL:** <https://www.ruby-forum.com/t/yaml-issues/139993>\
**Category:** Ruby\
**Created:** [June 9, 2008, 10:08pm UTC](https://www.ruby-forum.com/t/yaml-issues/139993 "2008-06-09T22:08:41Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [June 9, 2008, 10:08pm UTC](https://www.ruby-forum.com/t/yaml-issues/139993/1 "2008-06-09T22:08:41Z")

</div>

i thought yaml was built into Ruby 1.8.6. i seem to be getting  
exceptions in creating a store.  
irb(main):021:0\> require ‘yaml’  
=\> false  
irb(main):022:0\> y=YAML::Store.new(“c:\temp\yaml.store.1”)  
NameError: uninitialized constant YAML::Store  
from (irb):22  
irb(main):023:0\>

---

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [June 9, 2008, 10:26pm UTC](https://www.ruby-forum.com/t/yaml-issues/139993/2 "2008-06-09T22:26:20Z")

</div>

On Monday 09 June 2008, Junkone wrote:

> i thought yaml was built into Ruby 1.8.6. i seem to be getting  
> exceptions in creating a store.  
> irb(main):021:0\> require ‘yaml’  
> =\> false  
> irb(main):022:0\> y=YAML::Store.new(“c:\temp\yaml.store.1”)  
> NameError: uninitialized constant YAML::Store  
> from (irb):22  
> irb(main):023:0\>

You need to add

require ‘yaml/store’

Stefano

---

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [June 10, 2008, 9:47am UTC](https://www.ruby-forum.com/t/yaml-issues/139993/3 "2008-06-10T09:47:27Z")

</div>

If you require a file in IRB it will output ‘true’ if it is there

Therefore there is a problem with your installation

---

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [June 10, 2008, 10:41am UTC](https://www.ruby-forum.com/t/yaml-issues/139993/4 "2008-06-10T10:41:33Z")

</div>

On Tuesday 10 June 2008, jonty wrote:

> If you require a file in IRB it will output ‘true’ if it is there
> 
> Therefore there is a problem with your installation

Not exactly. The line

require ‘something’

returns true only if the file something.rb (or something.so or  
something.dll  
if it is a C extension) has been loaded. If that file has already been  
loaded,  
it won’t be loaded again and require will return false. For example:

irb(main):001:0\> require ‘yaml’  
=\> true  
irb(main):002:0\> require ‘yaml’  
=\> false

The first time, yaml.rb is indeed loaded, and require returns true. The  
second  
time, instead, require notices yaml.rb is already there (in particular,  
it  
looks in the $" global variable), doesn’t reload it and returns false.

Stefano

---

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [June 10, 2008, 10:47am UTC](https://www.ruby-forum.com/t/yaml-issues/139993/5 "2008-06-10T10:47:30Z")

</div>

On 10 Jun., 09:04, jonty [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > NameError: uninitialized constant YAML::Store  
> > from (irb):22  
> > irb(main):023:0\>

Everything is alright with his installation. When require returns  
false, the script has already been loaded.

---

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [June 10, 2008, 2:16pm UTC](https://www.ruby-forum.com/t/yaml-issues/139993/6 "2008-06-10T14:16:27Z")

</div>

On Tuesday 10 June 2008, Rick DeNatale wrote:

> Actually, it returns true if this invocation of require caused the file to  
> be loaded. The phrase “has been loaded” could be interpreted to mean “has  
> been loaded during or prior to this call” which is not the right sense.

Right.

Stefano

---

<div class="post-metadata">

**Author:** ![Junkone](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/e274bd/32.png) [@Junkone](https://www.ruby-forum.com/u/Junkone)\
**Post date:** [June 10, 2008, 2:10pm UTC](https://www.ruby-forum.com/t/yaml-issues/139993/7 "2008-06-10T14:10:34Z")

</div>

On Tue, Jun 10, 2008 at 3:55 AM, Stefano C.  
[removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> something.dll  
> if it is a C extension) has been loaded.

Actually, it returns true if this invocation of require caused the file  
to  
be loaded. The phrase “has been loaded” could be interpreted to mean  
“has  
been loaded during or prior to this call” which is not the right sense.

> time, instead, require notices yaml.rb is already there (in particular, it  
> looks in the $" global variable), doesn’t reload it and returns false.

And, to the original issue, if the file can’t be found, require won’t  
return  
anything, it will raise a LoadError exception.

–  
Rick DeNatale

My blog on Ruby  
[http://talklikeaduck.denhaven2.com/](http://talklikeaduck.denhaven2.com/)
