module TwitterCldr::Normalization
Constants
- DEFAULT_NORMALIZER
- VALID_NORMALIZERS
Public Class Methods
normalize(string, options = {})
click to toggle source
# File lib/twitter_cldr/normalization.rb, line 16 def normalize(string, options = {}) validate_form(form = extract_form_from(options)) Eprun.normalize(string, form) end
normalized?(string, options = {})
click to toggle source
# File lib/twitter_cldr/normalization.rb, line 21 def normalized?(string, options = {}) validate_form(form = extract_form_from(options)) Eprun.normalized?(string, form) end
Private Class Methods
extract_form_from(options)
click to toggle source
# File lib/twitter_cldr/normalization.rb, line 28 def extract_form_from(options) options.fetch(:using, DEFAULT_NORMALIZER).to_s.downcase.to_sym end
validate_form(form)
click to toggle source
# File lib/twitter_cldr/normalization.rb, line 32 def validate_form(form) unless VALID_NORMALIZERS.include?(form) raise ArgumentError.new("#{form.inspect} is not a valid normalizer "\ "(valid normalizers are #{VALID_NORMALIZERS.join(', ')})") end end