Skip to content

Instantly share code, notes, and snippets.

@djberg96
Last active December 16, 2015 21:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save djberg96/e08ba8bd9bef29a822ee to your computer and use it in GitHub Desktop.
Save djberg96/e08ba8bd9bef29a822ee to your computer and use it in GitHub Desktop.
# In lib/bar.rb
module Bar
STUFF = 7
end
require_relative 'bar/baz'
# In lib/bar/baz.rb
module Bar
class Baz
def initialize
puts Bar::STUFF
end
end
end
Bar::Baz.new
> ruby -Ilib -rbar lib/bar/baz.rb
# ERROR - uninitialized constant Bar::STUFF
Update: NM, working.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment