Publisher review:Float to_s hack for easy sprintf'ing - Float Hacks to_s override Float Hacks:to_s override.I really hate using sprintf, mainly because i always have to go online and look up the syntax. I figured i could make that a little easier. Now you can print floats with different precision as easily as:4.123456.to_s(1) # => "4.1"4.123456.to_s(3) # => "4.12"4.123456.to_s(3) # => "4.123"4.123456.to_s(4) # => "4.1235" (Note the auto rounding from 4.123456)4.123456.to_s # => "4.123456"
Float to_s hack for easy sprintf'ing is a Ruby script for Snippets scripts design by jake3030.
It runs on following operating system: Windows / Linux.
Operating system:Windows / Linux