Forums
New posts
Search forums
Members
Current visitors
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Menu
Log in
Register
Install the app
Install
Forums
Archive
Archive
Ruby
Overriding Float.round
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
[QUOTE="rpardee, post: 4512983"] LOL--found my problem. Sorry for polluting the list. I was misreading the error message to indicate that round was complaining about getting too *many* arguments--but it was complaining about getting too *few*--and on the call to Float.round() in my new version of Float.round(). So this works: class Float alias orig_round round def round(places) num = ("1" + "0"*places.to_i).to_f (self*num).orig_round/num end end [/QUOTE]
Verification
Post reply
Forums
Archive
Archive
Ruby
Overriding Float.round
Top