Scrubba: Clean your strings!
Scrubba is a tiny gem to strip and normalize whitespace. It provides a few convenient methods for working with ActiveRecord/ActiveModel/ActiveAttr/ActiveNode attributes too.
Add this line to your application's Gemfile:
And then execute:
Or install it yourself as:
$ gem install scrubba
require "scrubba" some_str = " foo \t bar " .(some_str) #=> "foo \t bar" .(some_str) #=> " foo bar "
In an ActiveRecord model:
require "scrubba" class Post < ActiveRecord::Base include :: strip :title, :body normalize :title end
Bug reports and pull requests are welcome on GitHub at https://github.com/jmdeldin/scrubba.
The gem is available as open source under the terms of the MIT License.