From: Logan Capaldo Date: 2007-09-27T08:24:04+09:00 Subject: Re: Aliasing return false On 9/26/07, Ari Brown wrote: > Hey all, > > I'm writing a quick DSL, and in it, I end up having to use return > false unless {} quite a bunch. > > Since I still need everything outside of the return false's, Stefan > 's Stepper code is of no use, although it is still quite > awesome. > > Is there a way to alias it from, say: > > return false unless { klass.method? } > > to: > > rule { klass.method? } > this is evil % cat rule.rb def rule(&b) r = b.call eval("return false", b) unless r end def a rule { false } 0 end def b rule { true } 1 end p a p b % ruby rule.rb false 1