class A
FOOBAR = 42
end
class B < A
class << self
def case_1
FOOBAR # <<< how to fix this?
end
def case_2
self::FOOBAR # <<< is this the proper way of doing it? / what does that do exactly?
end
end
def case_3
FOOBAR # cool
end
def self.case_4
FOOBAR # cool
end
end
# puts B.case_1 # => uninitialized constant Class::FOOBAR (NameError)
puts B.case_2
puts B.new.case_3
puts B.case_4
Y2xhc3MgQQogIEZPT0JBUiA9IDQyCmVuZAoKY2xhc3MgQiA8IEEKICBjbGFzcyA8PCBzZWxmCiAgICBkZWYgY2FzZV8xCiAgICAgIEZPT0JBUiAjIDw8PCBob3cgdG8gZml4IHRoaXM/CiAgICBlbmQKCiAgICBkZWYgY2FzZV8yCiAgICAgIHNlbGY6OkZPT0JBUiAjIDw8PCBpcyB0aGlzIHRoZSBwcm9wZXIgd2F5IG9mIGRvaW5nIGl0PyAvIHdoYXQgZG9lcyB0aGF0IGRvIGV4YWN0bHk/CiAgICBlbmQKICBlbmQKCiAgZGVmIGNhc2VfMwogICAgRk9PQkFSICMgY29vbAogIGVuZAogIAogIGRlZiBzZWxmLmNhc2VfNAogICAgRk9PQkFSICMgY29vbAogIGVuZAplbmQKCiMgcHV0cyBCLmNhc2VfMSAjID0+IHVuaW5pdGlhbGl6ZWQgY29uc3RhbnQgQ2xhc3M6OkZPT0JBUiAoTmFtZUVycm9yKQoKcHV0cyBCLmNhc2VfMgpwdXRzIEIubmV3LmNhc2VfMwpwdXRzIEIuY2FzZV80