Skip to content

Instantly share code, notes, and snippets.

@mehdi-farsi
Last active March 27, 2018 07:11
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 mehdi-farsi/56f1c458754fd06887e4 to your computer and use it in GitHub Desktop.
Save mehdi-farsi/56f1c458754fd06887e4 to your computer and use it in GitHub Desktop.
Alias on Class Method

Class methods are methods added on the singleton class of the object.

class Mail
  def self.is_delivered?
    true
  end
  
  self.singleton_class.send(:alias_method, :delivered?, :is_delivered?)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment