Skip to content

Instantly share code, notes, and snippets.

Created March 15, 2016 05:57
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 anonymous/3adf948389949eee3900 to your computer and use it in GitHub Desktop.
Save anonymous/3adf948389949eee3900 to your computer and use it in GitHub Desktop.
Why we need the singleton class method, why not just the private(self.x)?
class Beer
def self.pour=(x)
@piss = x
end
def self.pour
@piss
end
end
class Beer
class << self
attr_accesor: pour
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment