Creating a ! method

Hello,
  I have this code. It works fine but I would like to use round_to_interval!.
I could not figure out how to code that. Any suggestions?

class Time
   def round_to_interval!
      # how?
   end

   def round_to_interval
      self - (self.min % 10) * 60
   end
end

  Regards,
     Kurt

Time objects are immutable (like numbers, symbols, etc.), so you cannot alter them directly.

- Jamis

···

On Jun 13, 2005, at 11:51 AM, Kurt V. Hindenburg wrote:

Hello,
  I have this code. It works fine but I would like to use round_to_interval!.
I could not figure out how to code that. Any suggestions?

class Time
   def round_to_interval!
      # how?
   end

   def round_to_interval
      self - (self.min % 10) * 60
   end
end