I am new to ruby and practising modules
here is the file mystuff.rb
module MyStuff
def MyStuff.apple()
puts “I AM APPLES!”
end
end
#here is the file ex1.rb
require ‘mystuff’
MyStuff.apple()
when i execute ex1.rb it throws an error
[root@localhost ruby_practice]# ruby ex1.rb
internal:lib/rubygems/custom_require:29:in require': no such file to load -- mystuff (LoadError) from <internal:lib/rubygems/custom_require>:29:in
require’
from ex1.rb:1:in `’
Subject: unterminated string meets end of file
Date: mer 10 apr 13 03:30:47 +0900
Quoting siva kumar ([email protected]):
#here is the file ex1.rb
require 'mystuffb
MyStuff.apple()
when i execute ex1.rb it throws an error
ex1.rb:1: unterminated string meets end of file
Eh. Line 1 is
require 'mystuffb
Does it not look like something is missing?
Carlo
@Carlo
Sry there was a mistake i’ve edited the post
Solved it !!
added " $LOAD_PATH.unshift(File.dirname(FILE)) " before require.
Seems different versions of ruby works diffrently!
On Wed, Apr 10, 2013 at 8:49 AM, siva kumar [email protected]
wrote:
Solved it !!
added " $LOAD_PATH.unshift(File.dirname(FILE)) " before require.
Seems different versions of ruby works diffrently!
That’s a fix for a completely different issue.
Cheers
robert