Skip to content

Instantly share code, notes, and snippets.

@cannikin cannikin/leia.rb
Last active Oct 27, 2016

Embed
What would you like to do?
class Leia
@boyfriend = "Han Solo"
class << self
attr_reader :boyfriend
end
def boyfriend
self.class.boyfriend
end
end
Leia.boyfriend #=> "Han Solo"
leia = Leia.new
leia.boyfriend #=> "Han Solo"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.