Can Anyone please tell me how can we create an object of a class that is
present in one ruby file, in another ruby file? I tried using .new()
method but that doesn’t seem to work.It simply cannot find the required
It works when I create an object of class inside the same file ,but not
in another file.
For example , lets say there is a file , file1.rb which contains class
there is another file named file2.rb , that contains another class File2
I want to use the methods in file1.rb inside class File2 in file2.rb
Can someone tell how can I do that?
My codes are somewhat like this
object = File1.new
The error while running file2.rb is
file2.rb:3: uninitialized constant File1 (NameError)