Created
July 3, 2013 09:03
-
-
Save marvinahv/5916513 to your computer and use it in GitHub Desktop.
Helpers to make data Readable on Padrino Views
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Stc::App.helpers do | |
| class Readable | |
| def self.date(utc) | |
| utc.to_date.strftime("%B %-d, %Y") | |
| end | |
| def self.text_from_value(value) | |
| _text = value.split('_') | |
| _text.map!{|word| word.capitalize } | |
| text = _text.join(' ') | |
| end | |
| def self.currency(amount) | |
| "$#{"%05.2f" % amount}" | |
| end | |
| end | |
| end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment