From: Drew Olson Date: 2008-03-04T03:09:01+09:00 Subject: Re: BlockChainable 0.0.1 released Trans wrote: > On Mar 2, 11:31 am, Drew Olson wrote: >> chaining of method calls allows you to assert values within the blocks >> as well as calling any other methods from "up-scope" classes. >> >> I know, I know, I need a better description :) Take a look at a usage >> example more some simple ideas on using BlockChainable. And afterwards, >> install it like so: > > He he. You could use Zope terminology, "acquisition" :) > >> include BlockChainable >> def print_roster >> class with the >> # Student instance as a parameter. > > So I take it that the Student class does'nt work on it's own because > it would not be able to find #add_student_to_roster --sort of like the > opposite of a class using a mixin and not providing a prerequisite > method. > > This is an interesting library. I'm curious to see the underlying meta- > programming. > > T. Trans - You're exactly right. I actually considered now including the example because of this, but I thought it clarified some of the ideas from the description. If we wanted to remove the coupling, I could actually just call the Roster method directly from the Student block, passing self as the argument. I didn't like having to pass self, so I encapsulated the call into a student method, but, as you said, this does tie the Student implementation to the Roster implemetation. I'll consider changing this example. As far as the meta-programming, download the source :) It's only 30 lines of meta-goodness. - Drew -- Posted via http://www.ruby-forum.com/.