module JapanETC::Util
Public Instance Methods
convert_fullwidth_characters_to_halfwidth(string)
click to toggle source
# File lib/japan_etc/util.rb, line 13 def convert_fullwidth_characters_to_halfwidth(string) return nil unless string string.tr(' A-Za-z0-9', ' A-Za-z0-9') end
convert_to_integer(object)
click to toggle source
# File lib/japan_etc/util.rb, line 25 def convert_to_integer(object) case object when Numeric Integer(object) when String Integer(object.sub(/\A0+/, '')) else raise ArgumentError end end
normalize(string)
click to toggle source
# File lib/japan_etc/util.rb, line 7 def normalize(string) return nil unless string convert_fullwidth_characters_to_halfwidth(string) end
remove_whitespaces(string)
click to toggle source
# File lib/japan_etc/util.rb, line 19 def remove_whitespaces(string) return nil unless string string.tr(' ', '') end