Skip to content

Instantly share code, notes, and snippets.

@wookay
Created February 22, 2010 15:20
Show Gist options
  • Save wookay/311151 to your computer and use it in GitHub Desktop.
Save wookay/311151 to your computer and use it in GitHub Desktop.
Boogeyman
class Boogeyman
def self.latest
@@latest
end
# We'll redefine initialize
def initialize(name, location)
@name = name
@location = location
@@latest = @name
@@location = @location
puts "Yes, master?"
end
end
monster1 = Boogeyman.new("Macabre Mac", "Seattle, WA")
# → Yes, master?
monster2 = Boogeyman.new("Gory Gary", "Reston, WV")
# → Yes, master?
puts Boogeyman.latest
# → Gory Gary
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment