Stringify_stuff is a project mainly written in Ruby, based on the MIT license.
A Rails plugin for converting values to and from strings
StringifyStuff adds virtual attributes to your models to simplify interactions with certain datatypes. There are currently three parts:
Converts from date/time values to strings and back.
Converts from decimal to money and back.
Converts a decimal value to a percentage string
class MyModel < ActiveRecord::Base
stringify_stuff
stringify_money :cost
stringify_time :end_date
stringify_percentage :margin
validate :money_strings_invalid?, :time_strings_invalid?,
end
This gives you a number of useful methods:
stringify_money
stringify_time
Currently, string formats for dates and money are hard-coded, but hopefully one day I'll make them so they're configurable without delving inside the plugin.
StringifyStuff was inspired by Ryan Bates' Railscast on Making a Plugin.
Copyright (c) 2011 Nick Morgan, released under the MIT license