From: Simen Edvardsen Date: 2006-10-03T23:16:42+09:00 Subject: Re: How to Call a static method? On 10/3/06, Daniel V�lkerts wrote: > Hi there, after I searched the ruby-doc.org site I couldn't find a hint > how to call a class method on different classes. > > I've a helper class which parses a text input and which should either call > > Role.something or > > Organisation.anotherthing > > depening which parameter was passed. > > Please give a little hint to proceed. Thanks a lot... > -- > Daniel V�lkerts > Protected by Anti Pesto. -- Wallace & Gromit > > class Test def self.test puts "The huge test...OF DOOM!" end end Test.test # => The huge test...OF DOOM! Test.test isn't really a static method, but a singleton method on Test. Then just do a test in your method: def call_one_or_the_other(x) case x when SomeClass Role.something when OtherClass Organisation.anotherthing end end -- - Simen