Skip to content
Browse files

Added method to number tokenizer that calculates an array of valid ty…

…pes (looks at locale data)
  • Loading branch information...
1 parent 81f9e83 commit a398dd96b0e0fe56acc5dc1ffcfd0d047075f92b Cameron Dutro committed Nov 14, 2012
Showing with 8 additions and 1 deletion.
  1. +8 −1 lib/twitter_cldr/tokenizers/numbers/number_tokenizer.rb
View
9 lib/twitter_cldr/tokenizers/numbers/number_tokenizer.rb
@@ -45,7 +45,7 @@ def tokens(options = {})
@format = options[:format] || @format || :default
path = full_path
- positive, negative = traverse(path).split(/;/)
+ positive, negative = traverse(path).to_s.split(/;/)
sign = options[:sign] || :positive
pattern = case sign
@@ -66,6 +66,13 @@ def symbols
traverse(@symbol_path)
end
+ def valid_types
+ VALID_TYPES.select do |type|
+ result = traverse(@base_path + @paths[type])
+ !!result ? result.size > 0 : result
+ end
+ end
+
protected
def full_path

0 comments on commit a398dd9

Please sign in to comment.
Something went wrong with that request. Please try again.