From: Fabian Senftenberg Date: 2001-12-11T01:39:46+09:00 Subject: [ruby-talk:28099] Ensuring a specific type Is there any way I can make sure that an expression (a block) is of a specific type? Suppose, I have a fancy little class like the following: class Interval @start = Time.new() @duration = 0 def initialize(s, d = 0) @start = s @duration = d end def end() return #{@start + @duration}.usec end end Now, the definition of the end method is not correct. Ruby complains with "undefined method `usec' for 0:Fixnum (NameError)". How may I tell the block "#{@start + @duration}" that is is of type Time and nothing else? -- senf