output:
People Magazine''s Breaking News: OMG! Lindsey Lohan is trying to score
coke
while under the influence.. KeWl!!!!
US Weekly''s Breaking News: OMG! Lindsey Lohan is trying to score coke
while
under the influence.. KeWl!!!!
InTouch''s Breaking News: OMG! Lindsey Lohan is trying to score coke
while
under the influence.. KeWl!!!!
CNN''s Breaking News: OMG! Lindsey Lohan is trying to score coke while
under
the influence.. KeWl!!!!
People Magazine''s Breaking News: OMG! Britney Spears is attempting
another
comeback . KeWl!!!!
US Weekly''s Breaking News: OMG! Britney Spears is attempting another
comeback . KeWl!!!!
InTouch''s Breaking News: OMG! Britney Spears is attempting another
comeback
. KeWl!!!!
CNN''s Breaking News: OMG! Britney Spears is attempting another comeback
.
KeWl!!!!
People Magazine''s Breaking News: OMG! Paris Hilton is such a stronger
person
now that she''s been through jail. KeWl!!!!
US Weekly''s Breaking News: OMG! Paris Hilton is such a stronger person
now
that she''s been through jail. KeWl!!!!
InTouch''s Breaking News: OMG! Paris Hilton is such a stronger person
now
that she''s been through jail. KeWl!!!!
CNN''s Breaking News: OMG! Paris Hilton is such a stronger person now
that
she''s been through jail. KeWl!!!!
On 7/26/07, blinking bear
<blinkingbear-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:>
> Sorry, that name is a misnomer. However, I was excited to find that Ruby
> has a built in Observable module and I''m pretty bored, so I
apologize in
> advance....
>
> require ''observer''
>
> # one who is observed
> class Celebrity
> include Observable
>
> attr_accessor :name
> attr_reader :is
>
> def is=(val)
> @is = val
> changed
> notify_observers(self)
> end
> end
>
> # one who does the observering
> class TrashMag
> attr_accessor :name
> def update(sender)
> puts "#{name}''s Breaking News: OMG! #{sender.name} is #{
sender.is}.
> KeWl!!!!"
> end
> end
>
> celebs = []
>
> lohan = Celebrity.new
> lohan.name = "Lindsey Lohan"
> celebs << lohan
>
> britney = Celebrity.new
> britney.name = "Britney Spears"
> celebs << britney
>
> paris = Celebrity.new
> paris.name = "Paris Hilton"
> celebs << paris
>
> rags = ["People Magazine","US
Weekly","InTouch","CNN"].each do |name|
> mag = TrashMag.new
> mag.name = name
> celebs.each { |celeb| celeb.add_observer (mag) }
> end
>
>
> lohan.is = "trying to score coke while driving under the
influence."
> britney.is = "attempting another comeback sans undergarments"
> paris.is = "such a morally sound person now that she''s been
through
> jail"
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---