class Unicode::Japanese

Public Class Methods

convert(action, string) click to toggle source
# File lib/unicode/japanese.rb, line 5
def convert(action, string)
  pattern = Pattern.__send__(action)# rescue raise(NotImplementedError, "Undefined Pattern: #{action}")
  table   = Table  .__send__(action)# rescue raise(NotImplementedError, "Undefined Table: #{action}")
  string.gsub!(pattern){table[$1]}
  return string
end
h2z(str) click to toggle source
# File lib/unicode/japanese.rb, line 22
def h2z(str)
  str = str.to_s.dup
  convert('h2zKanaD', str)
  convert('h2zKanaK', str)
  convert('h2zNum', str)
  convert('h2zAlpha', str)
  convert('h2zSym', str)
  str
end
z2h(str) click to toggle source
# File lib/unicode/japanese.rb, line 12
def z2h(str)
  str = str.to_s.dup
  convert('z2hKanaD', str)
  convert('z2hKanaK', str)
  convert('z2hNum', str)
  convert('z2hAlpha', str)
  convert('z2hSym', str)
  str
end