News for hackers. Stuff that matters.
Re:Ruby 2.1 Released by radq on Wednesday December 25, 2013 @03:36PM (#6964154)
Looks like there is already a gem backporting String#scrub: https://github.com/hsbt/string-scrub/

It was mentioned in the changelog.

Re:Ruby 2.1 Released by jrochkind1 on Wednesday December 25, 2013 @04:18PM (#6964285)
awesome, thanks. Looks like that backport may be only for ruby 2.0 (not 1.9), and is a compiled C extension.

It won't take many lines of pure ruby code to do it for ruby 1.9 too, although presumably not performing quite as well as a C version.

At any rate, this is definitely something I and people I know need to do all the time, although apparently most ruby devs never need to do it; but I'm glad it's finally made it into stdlib.

Re:Ruby 2.1 Released by jrochkind1 on Thursday December 26, 2013 @11:32AM (#6966742)
That backport works on MRI 2.0.

I've completed a pure-ruby polyfill that should work on 1.9 as well as 2.0, any ruby interpreter including jruby. (It does have some issues mentioned in the readme).

https://github.com/jrochkind/scrub_rb