Create a gist now

Instantly share code, notes, and snippets.

# A representation of the module in question
module FormatHelper
def phone_number
# return formatted contact number
end
end
class MyClass
include FormatHelper
def self.my_method
phone_number
end
end
MyClass.my_method # fails with “phone_number undefined”
MyClass.phone_number # error
MyClass.new.phone_number # works, because it includes the methods on the instance of MyClass and not the class MyClass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment