Skip to content

Instantly share code, notes, and snippets.

@rachidcalazans
Created August 15, 2018 11:53
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 rachidcalazans/548ed4d504d8c8be39a3706e17930186 to your computer and use it in GitHub Desktop.
Save rachidcalazans/548ed4d504d8c8be39a3706e17930186 to your computer and use it in GitHub Desktop.
Example I for the Post - Design Patterns in Ruby - Strategy - Part I
receivers = []
subject = 'Some subject'
content = 'Some content'
ios_app_token = 'Ja80-1jd81-AlI71'
ios_strategy = IosStrategy.new(ios_app_token)
ios_notification = Notification.new(ios_strategy, receivers, subject, content)
email_from = 'contact@email.com'
email_strategy = EmailStrategy.new(email_from)
email_notification = Notification.new(email_strategy, receivers, subject, content)
ios_notification.notify #=> 'Notifying through iOS Strategy. App token: Ja80-1jd81-AlI71'
email_notification.notify #=> 'Notifying through email Strategy. From: contact@email.com'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment