-
-
Save wjn/3157853 to your computer and use it in GitHub Desktop.
Convert Number to Word - Sass Function
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
require 'sass' | |
require 'linguistics' | |
## this is the linguistics gem, | |
## instructions on how to use, http://deveiate.org/projects/Linguistics/wiki/English | |
## 5.en.numwords would output 'five' | |
## Sass Function | |
module Sass::Script::Functions | |
def convertNumberToWord(number) | |
assert_type number, :Number | |
Sass::Script::Number.new(number.value.convertNumberToWord.en.numwords) | |
end | |
declare :convertNumberToWord, :args => [:number] | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment