File tree Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Expand file tree Collapse file tree 2 files changed +6
-6
lines changed Original file line number Diff line number Diff line change 1- source : rubygems
1+ source 'http:// rubygems.org'
22
33group :development do
44 gem "RedCloth" , "~> 4.2"
Original file line number Diff line number Diff line change 11---
2- layout : recipe Observer Pattern
2+ layout : recipe
33title : Observer Pattern
44chapter : Design patterns
55---
@@ -20,7 +20,7 @@ class PostOffice
2020 subscriber.callback(item) for subscriber in @subscribers when subscriber.item is item
2121 subscribe: (to, onNewItemReleased) ->
2222 @subscribers .push {'item': to , 'callback': onNewItemReleased }
23-
23+
2424class MagazineSubscriber
2525 onNewMagazine: (item) ->
2626 alert "I've got new "+item
@@ -41,7 +41,7 @@ postOffice.notifyNewItemReleased "Mens Health"
4141
4242## Discussion
4343
44- Here you have an observer object (PostOffice) and observable objects (MagazineSubscriber, NewspaperSubscriber).
45- To be notified about an event of publishing new periodical observable object should make subscribtion on PostOffice.
46- Every of subscribed objects is stored internaly in the PostOffice array of subscribtions.
44+ Here you have an observer object (PostOffice) and observable objects (MagazineSubscriber, NewspaperSubscriber).
45+ To be notified about an event of publishing new periodical observable object should make subscribtion on PostOffice.
46+ Every of subscribed objects is stored internaly in the PostOffice array of subscribtions.
4747Every subscriber is notified on new concrete periodical is published.
You can’t perform that action at this time.
0 commit comments