Advertisement
Guest User

Untitled

a guest
Oct 9th, 2015
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. $ cat foo.rb
  2. module Stock
  3. STOCK_LIST = 'I am groot'
  4. end
  5.  
  6. module Stock
  7. class Holder
  8. def initialize
  9. puts STOCK_LIST
  10. end
  11. end
  12. end
  13.  
  14. class Stock::Holder2
  15. def initialize
  16. puts STOCK_LIST
  17. end
  18. end
  19.  
  20. Stock::Holder.new
  21. Stock::Holder2.new
  22.  
  23.  
  24. $ ruby foo.rb
  25. I am groot
  26. foo.rb:15:in `initialize': uninitialized constant Stock::Holder2::STOCK_LIST (NameError)
  27. from foo.rb:20:in `new'
  28. from foo.rb:20:in `<main>'
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement