From: Roger Pack on 14 Jul 2010 10:27 > Even though I realize that the templating engine should not be messing > with the ruby pre-defined precisions, I would like to ask what would be > the recommended way to get all ruby versions to behave the same? I think it's something like this for <= 1.9.1 class Float def to_s num = "%.12f" % self num.sub /\.0+$/, '' end end -- Posted via http://www.ruby-forum.com/.
From: Diogo Almeida on 14 Jul 2010 12:08 Roger Pack wrote: > >> Even though I realize that the templating engine should not be messing >> with the ruby pre-defined precisions, I would like to ask what would be >> the recommended way to get all ruby versions to behave the same? > > I think it's something like this for <= 1.9.1 > > class Float > def to_s > num = "%.12f" % self > num.sub /\.0+$/, '' > end > end Thanks Roger. I'll wait and see if the guys from shopify will accept my new assertions based on regexp, so they don't change the new behaviors introduced with the latest versions. Best regards. -- Posted via http://www.ruby-forum.com/.
First
|
Prev
|
Pages: 1 2 Prev: How to install 1.9.2 on windows 7 Next: Programming TCP-protocol Server (MineCraft) |