From: Tobias Reif Date: 2002-01-29T21:18:56+09:00 Subject: Re: Ensuring a specific type Ron Jeffries wrote: > On Mon, 10 Dec 2001 1 > As a matter of style, I would not implement my classes to check their > arguments: code with class-checking is generally considered tacky. I > might /convert/ arguments, for example something like > > def initialize(s, d = 0) > @start = s.to_time > @duration = d.to_i > end > > Then I'd write my code to work correctly without type-checking. > > Just a matter of style, but I find it to be valuable. Perhaps you will > too. what about stuff like def add_element arg if arg.kind_of? Array arg.each do |element| element.add_element element # call myself end else # do add one element end end Tobi -- http://www.pinkjuice.com/