fork(1) download
  1. class A
  2. FOOBAR = 42
  3. end
  4.  
  5. class B < A
  6. class << self
  7. def case_1
  8. FOOBAR # <<< how to fix this?
  9. end
  10.  
  11. def case_2
  12. self::FOOBAR # <<< is this the proper way of doing it? / what does that do exactly?
  13. end
  14. end
  15.  
  16. def case_3
  17. FOOBAR # cool
  18. end
  19. end
  20.  
  21. # puts B.case_1 # => uninitialized constant Class::FOOBAR (NameError)
  22.  
  23. puts B.case_2
  24. puts B.new.case_3
Success #stdin #stdout 0s 4716KB
stdin
Standard input is empty
stdout
42
42