How do I instantiate Foo from bar.rb?
# foo.rb class Foo def initialize puts "foo" end end # bar.rb require 'foo' Foo.new $ ruby bar.rb /home/thufir/.rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- foo (LoadError) from /home/thufir/.rvm/rubies/ruby-2.4.1/lib/ruby/site_ruby/2.4.0/rubygems/core_ext/kernel_require.rb:55:in `require' from bar.rb:2:in `<main>' Not using modules at the moment. Works fine when Foo is declared inside the same script:
# bar.rb with Foo declared inside class Foo def initialize puts "foo" end end Foo.new $ ruby bar.rb foo