Le 4 novembre 2006 04:57, Phrogz a ñÄrit : > Stephane Wirtel wrote: >> I would like to know if there is a way to simplify this code >> >> object.instance_of? WSDL::XMLSchema::ComplexContent or >> object.instance_of? WSDL::XMLSchema::ComplexType or >> object.instance_of? WSDL::XMLSchema::SimpleType or > [snip] > > case object > when WSDL::XMLSchema::ComplexContent, WSDL::XMLSchema::ComplexType, > WSDL::XMLSchema::SimpleType > # your code here > end Maybe more legible (and allows you to reuse the test) : LIST = [ WSDL::XMLSchema::ComplexContent, WSDL::XMLSchema::ComplexType, WSDL::XMLSchema::SimpleType, ... ] ... case object when *LIST ... end Fred -- Young at heart an' it gets so hard to wait When no one I know can seem to help me now Old at heart but I mustn't hesitate If I'm to find my way out (Guns n' Roses, Estranged)