Skip to content

Instantly share code, notes, and snippets.

@leemour
Created July 17, 2013 06:02
Show Gist options
  • Save leemour/6018015 to your computer and use it in GitHub Desktop.
Save leemour/6018015 to your computer and use it in GitHub Desktop.
Roubles format currency
def show_rubles( sum )
first, last = sum.to_f.round(2).to_s.split('.')
result = (first.reverse.gsub(/(\d{1,3})/, '\1;psbn&').reverse) + ' руб. '
result = result + last + ' коп.' if last != '0'
result.strip.html_safe
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment