Skip to content

Instantly share code, notes, and snippets.

@Sihui
Created July 20, 2017 04:27
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 Sihui/f7012839c6b5679e9f8d481950fc9db2 to your computer and use it in GitHub Desktop.
Save Sihui/f7012839c6b5679e9f8d481950fc9db2 to your computer and use it in GitHub Desktop.
Design Pattern: Observer and Podcasts
class Podcast
attr_reader :episodes
def initialize()
@episodes = []
end
def add_episode(new_episode, sihui)
episodes << new_episode
sihui.update(self)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment