Skip to content

Instantly share code, notes, and snippets.

@makevoid
Created May 17, 2009
Embed
What would you like to do?
contstants and inheritance
class Account
def initialize
@host = self.class::HOST
end
end
class A < Account
HOST = "host A"
end
class B < Account
HOST = "host B"
end
p A.new #=> #<A:0x1a2d5cc @host="host A">
p B.new #=> #<B:0x1a2d4dc @host="host B">
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment