Overriding to_s method of BIgDecimal

I am overriding to_s method of BigDecimal class as below and its working
fine.
Wanted to confirm is there any other better way to do this ? Thanks!

49 class BigDecimal
50 alias :old_s :to_s
51 def to_s
52 return to_i.to_s if eql? to_i
53 self.old_s
54 end
55 end


sαη∂ιρ Rαηѕιηg


blog www.funonrails.com
twitter @sandipransing
skype sandip.ransing

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs