Problemm using ruby classes

A

Andrea Aaa

I'm new on ruby so probably my question is stupid.
I've created some ruby classes, but when I try to use them with the
operator .new from another program file, it gives me this error:

uninitializad constant SQLite_Utility (NameError)

Please help me.

Thanks
 
S

Stefano Crocco

I'm new on ruby so probably my question is stupid.
I've created some ruby classes, but when I try to use them with the
operator .new from another program file, it gives me this error:

uninitializad constant SQLite_Utility (NameError)

Please help me.

Thanks

You need to require the file where you defined the class. For example

File file1.rb

class C
...
end

File file2.rb

require 'file1'

C.new


I hope this helps

Stefano
 
M

Marc Heiler

uninitializad constant SQLite_Utility (NameError)


To make it known you need to
require
it.
 
S

Sebastian Hungerecker

Andrea said:
I try to use them with the operator .new

Your question has already been answered, so let me just point out this:
new is not an operator it is nothing more than a simple method call.

HTH,
Sebastian
 

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
474,201
Messages
2,571,049
Members
47,655
Latest member
eizareri

Latest Threads

Top