Class: Unicode::Japanese
- Inherits:
-
Object
- Object
- Unicode::Japanese
- Defined in:
- lib/unicode/japanese.rb,
lib/unicode/japanese/table.rb,
lib/unicode/japanese/pattern.rb
Defined Under Namespace
Class Method Summary collapse
Class Method Details
.convert(action, string) ⇒ Object
6 7 8 9 10 11 |
# File 'lib/unicode/japanese.rb', line 6 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) ⇒ Object
23 24 25 26 27 28 29 30 31 |
# File 'lib/unicode/japanese.rb', line 23 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) ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/unicode/japanese.rb', line 13 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 |