Skip to content

Instantly share code, notes, and snippets.

@Mehonoshin
Created February 18, 2013 12:57
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 Mehonoshin/4977178 to your computer and use it in GitHub Desktop.
Save Mehonoshin/4977178 to your computer and use it in GitHub Desktop.
Чтобы получить в наследуемом методе доступ к константе, определенной в дочерних классах, надо делать так:
class A
def initialize
puts self.class::MY_CONSTANT
end
end
class B < A
MY_CONSTANT = "something"
end
o = B.new
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment