Ruby on Rails Tuesday, December 23, 2014

Can anyone shed some light on this?

https://github.com/LouHenryAlvarez/jackbox

It looks like some sort of abstraction. But I a having trouble
understanding how this works. Also the following code doesn't make any
sense to me.

<pre>

Furhtermore, these decorators can be re-applied multiple times to the
same receiver:

cup = Coffee.new.enrich(milk).enrich(sprinkles).enrich(sprinkles)
# or even..
cup = Coffee.new.enrich milk, sprinkles, sprinkles

cup.cost.should == 2.10
cup.should be_instance_of(Coffee)
cup.injectors.should == [:milk, :sprinkles, :sprinkles

</pre>

Isn't this sort of thing already possible already. Can someone explain?


Thanks,

Kike

--
Posted via http://www.ruby-forum.com/.

--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rubyonrails-talk+unsubscribe@googlegroups.com.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/rubyonrails-talk/92cf14bfd1aa8506fc9875e89fe67758%40ruby-forum.com.
For more options, visit https://groups.google.com/d/optout.

No comments:

Post a Comment