# New instance (uninitialized constant)

**URL:** <https://www.ruby-forum.com/t/new-instance-uninitialized-constant/119109>\
**Category:** Ruby\
**Created:** [November 3, 2007, 5:28am UTC](https://www.ruby-forum.com/t/new-instance-uninitialized-constant/119109 "2007-11-03T05:28:25Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [November 3, 2007, 5:28am UTC](https://www.ruby-forum.com/t/new-instance-uninitialized-constant/119109/1 "2007-11-03T05:28:25Z")

</div>

I need to indicate where to find the Song class. With a module? I’m  
looking for the simplest technique (hint pls):

C:\Documents and Settings\nsaunders\Desktop\>  
C:\Documents and Settings\nsaunders\Desktop\>  
C:\Documents and Settings\nsaunders\Desktop\>type Song.rb  
class Song  
def initialize(name, artist, duration)  
@name = name  
@artist = artist  
@duration = duration  
end  
end  
C:\Documents and Settings\nsaunders\Desktop\>  
C:\Documents and Settings\nsaunders\Desktop\>type Sing.rb  
aSong = Song.new(“Bicylops”, “Fleck”, 260)  
C:\Documents and Settings\nsaunders\Desktop\>  
C:\Documents and Settings\nsaunders\Desktop\>Sing.rb  
C:/Documents and Settings/nsaunders/Desktop/Sing.rb:1: uninitialized  
constant So  
ng (NameError)

C:\Documents and Settings\nsaunders\Desktop\>  
C:\Documents and Settings\nsaunders\Desktop\>

thanks,

Thufir

---

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [November 3, 2007, 7:59am UTC](https://www.ruby-forum.com/t/new-instance-uninitialized-constant/119109/2 "2007-11-03T07:59:51Z")

</div>

On Nov 3, 2007, at 12:24 AM, Thufir wrote:

> ```
> @duration = duration
> 
> ```
> 
> C:\Documents and Settings\nsaunders\Desktop\>  
> C:\Documents and Settings\nsaunders\Desktop\>

Hint: Insert

```
require 'Song'

```

at the beginning of Sing.rb.

Regards, Morton

---

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [November 7, 2007, 6:01am UTC](https://www.ruby-forum.com/t/new-instance-uninitialized-constant/119109/3 "2007-11-07T06:01:34Z")

</div>

Thanks, Morton 🙂

---

<div class="post-metadata">

**Author:** ![Thufir](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/ee7513/32.png) [@Thufir](https://www.ruby-forum.com/u/Thufir)\
**Post date:** [November 7, 2007, 6:05am UTC](https://www.ruby-forum.com/t/new-instance-uninitialized-constant/119109/4 "2007-11-07T06:05:39Z")

</div>

On Nov 2, 11:47 pm, removed\_email\_address@domain.invalid wrote:

> > class Song  
> > C:\Documents and Settings\nsaunders\Desktop\>Sing.rb
> 
> at the beginning of Sing.rb.

Or:  
require ‘Song.rb’

The point being that you are specifying the name of the _file_ to load  
(with or without the .rb extension), not the name of the class. In  
your example, they happen to be the same.

Just wanted to be clear about that for your future Ruby programming  
endeavors.
