Skip to content

Instantly share code, notes, and snippets.

@patrykkalinowski
Created June 9, 2015 14:13
Show Gist options
  • Save patrykkalinowski/c7bc2a9a25c38779307e to your computer and use it in GitHub Desktop.
Save patrykkalinowski/c7bc2a9a25c38779307e to your computer and use it in GitHub Desktop.
dependency injection
class Trial
def check_activity
if activity > 100
send_mail(Mailer)
end
end
def send_mail(mail)
mail.new(id, name, date, total_activity)
end
end
class Mailer
def initialize(id, name, date, total_activity)
# blabla
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment