Skip to content

Instantly share code, notes, and snippets.

@thiagovsk
Last active March 16, 2022 21:30
Show Gist options
  • Save thiagovsk/90314510bb46923b78a2429b54d81d57 to your computer and use it in GitHub Desktop.
Save thiagovsk/90314510bb46923b78a2429b54d81d57 to your computer and use it in GitHub Desktop.
module Formatter
def self.included base
base.extend ClassMethods
end
module ClassMethods
def class_method
"yahy"
end
end
def formatted_phone
phone.delete("^0-9")
end
end
class Payment
include Formatter
def phone(phone)
formatted_phone(phone)
end
end
class Contact
include Formatter
def phone(phone)
formatted_phone(phone)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment