Skip to content

Instantly share code, notes, and snippets.

@mec
Created March 25, 2022 13:08
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 mec/b2a8e138a0a9247461e014ab43ea45e1 to your computer and use it in GitHub Desktop.
Save mec/b2a8e138a0a9247461e014ab43ea45e1 to your computer and use it in GitHub Desktop.
Ruby - Prepend, Extend and Include

include will add the module after the class in the ancestor chain, can call the instance methods, you will not see the methods in ls class

prepend will add the module before the class in the ancestor chain, can call the instance methods, you will not see the methods in ls class

extend will add the module methods but not effect the ancestor chain, any methods will be added as class methods and you will see instance methods in ls class

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment