Skip to content

Instantly share code, notes, and snippets.

@marvinahv
Created July 3, 2013 09:03
Show Gist options
  • Save marvinahv/5916513 to your computer and use it in GitHub Desktop.
Save marvinahv/5916513 to your computer and use it in GitHub Desktop.
Helpers to make data Readable on Padrino Views
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