Skip to content

Instantly share code, notes, and snippets.

@makevoid
Created May 17, 2009 15:05
Show Gist options
  • Save makevoid/113028 to your computer and use it in GitHub Desktop.
Save makevoid/113028 to your computer and use it in GitHub Desktop.
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