Module: Charwidth::ClassMethods

Included in:
Charwidth
Defined in:
lib/charwidth.rb

Instance Method Summary collapse

Instance Method Details

#normalize(string, options = {}) ⇒ Object

Normalize Unicode fullwidth / halfwidth (zenkaku / hankaku) characters options:

only: [:ascii, :white_parenthesis, :cjk_punctuation, :katakana, :space],
except: [:ascii, :white_parenthesis, :cjk_punctuation, :katakana, :space]



14
15
16
# File 'lib/charwidth.rb', line 14

def normalize(string, options = {})
  normalize!(string.dup, options)
end

#normalize!(string, options = {}) ⇒ Object

Normalize Unicode fullwidth / halfwidth (zenkaku / hankaku) characters (destructive)



19
20
21
22
# File 'lib/charwidth.rb', line 19

def normalize!(string, options = {})
  unify_voiced_katakana!(string)
  normalize_charwidth!(string, options)
end