From: dejaspam@... (Bill Atkins) Date: 2004-05-30T02:08:38+09:00 Subject: Re: defining condititions How about just a simple proc object? my_set.rules = proc { !name("orange") && hasProperty("color") && (hasProperty("size") || hasProperty("weight")) } Then just do something like obj.instance_eval rules for whatever object has the methods in your example. Bill Florian Weber wrote in message news:... > hi! > > im trying to define a set of rules with ruby, however i cant find a more > ruby-like way to do so.. > > instead of doing something like > > my_set.add(NotNamedRule("orange").new) > my_set.add(HasPropertyRule("color").new) > my_set.add(OrRule(HasPropertyRule("size").new, > HasPropertyRule("weight").new)) > > (i know this is a horrible example. excuse the awful 'design'. its > justs to illustrate > what i not wanna have ; ) > > i wanna do something like > > my_set.rules = !name("orange") && hasProperty("color") && > (hasProperty("size") || hasProperty("weight")) > > can anybody think of a nice way to do this? > > thanks a lot for any feedback! > > ciao! > florian