From: Peter Vandenabeele Date: 2012-02-10T05:52:33+09:00 Subject: Re: While calling module, throwing error --0023544713ecdc04d504b88e307d Content-Type: text/plain; charset=UTF-8 On Thu, Feb 9, 2012 at 9:31 PM, Hasmukh Patel wrote: > Mymodule.rb > > module Mymodule > def Mymodule.mymessage > puts "You have four weeks in a month" > end > end > > > callingclass.rb > > #!/user/bin/ruby > require "Mymodule" > include Mymodule > Mymodule.mymessage > > Throwing following error > > C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': > cannot loa > d such file -- Mymodule (LoadError) > from C:/Ruby193/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in > `require > ' > from callingclass.rb:3:in `
' > Has to do with $LOAD_PATH (alias $: ) from which '.' was removed from it in Ruby 1.9.x You will find many explanations searching for ("ruby load_path 1.9") The first one is already relevant: http://stackoverflow.com/questions/2900370/why-does-ruby-1-9-2-remove-from-load-path-and-whats-the-alternative HTH, Peter -- *** Available for a new project *** Peter Vandenabeele http://twitter.com/peter_v http://rails.vandenabeele.com http://coderwall.com/peter_v --0023544713ecdc04d504b88e307d--