Skip to content

Instantly share code, notes, and snippets.

@makevoid
Created May 17, 2009 15:05
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 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