Sha256: d859a75cf444d18d2103462acaf07adf3912b0ce77d20e2c5d1b00eeccc7e8b3
Contents?: true
Size: 684 Bytes
Versions: 8
Compression:
Stored size: 684 Bytes
Contents
# frozen_string_literal: true module JapanETC module Util module_function def normalize(string) return nil unless string convert_fullwidth_characters_to_halfwidth(string) end def convert_fullwidth_characters_to_halfwidth(string) return nil unless string string.tr(' A-Za-z0-9', ' A-Za-z0-9') end def remove_whitespaces(string) return nil unless string string.tr(' ', '') end def convert_to_integer(object) case object when Numeric Integer(object) when String Integer(object.sub(/\A0+/, '')) else raise ArgumentError end end end end
Version data entries
8 entries across 8 versions & 1 rubygems