Created
January 6, 2014 22:28
-
-
Save camertron/8290969 to your computer and use it in GitHub Desktop.
RBNF example with twitter-cldr-rb, v3.0 branch
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 'twitter_cldr' | |
num = 1234.localize(:en) # locale is optional, defaults to :en | |
# "one thousand two hundred thirty-four" | |
num.spellout | |
# ["SpelloutRules", "OrdinalRules"] | |
num.rbnf.group_names | |
# ["spellout-numbering-year", "spellout-numbering-verbose", "spellout-ordinal" ... ] | |
num.rbnf.rule_set_names_for_group("SpelloutRules") | |
# "one thousand two hundred thirty-fourth" | |
num.to_rbnf_s("SpelloutRules", "spellout-ordinal") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment