Skip to content

Instantly share code, notes, and snippets.

@cannikin
Last active October 27, 2016 16:07
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 cannikin/1517637e873c6c7527ef3c25570bd06b to your computer and use it in GitHub Desktop.
Save cannikin/1517637e873c6c7527ef3c25570bd06b to your computer and use it in GitHub Desktop.
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