From: Aldric Giacomoni Date: 2009-12-04T01:15:43+09:00 Subject: Re: easy dsl style method generation? Roger Pack wrote: > Here's what I wish I could easily do. > > Move.from(x).to(y) > > and set it up easily, like > > class Move > def from(x).to(y) > > end > end Apparently, what you're looking for is something like this: class Move def from x @x = x return self end def to y raise ArgumentError, "X is not defined!" unless @x @y = y # Do your actual move end end In plain english, "from" returns an object on which you can call "to". I mean, I would just do "def move_from_to x, y" but maybe your way can be done.. Have fun with the error checking though. -- Posted via http://www.ruby-forum.com/.