Class: PinyinResource
- Inherits:
-
Object
- Object
- PinyinResource
- Includes:
- Singleton
- Defined in:
- lib/pinyin_resource.rb
Instance Attribute Summary collapse
-
#dict ⇒ Object
Returns the value of attribute dict.
Instance Method Summary collapse
-
#initialize ⇒ PinyinResource
constructor
A new instance of PinyinResource.
Constructor Details
#initialize ⇒ PinyinResource
Returns a new instance of PinyinResource.
6 7 8 9 10 11 12 |
# File 'lib/pinyin_resource.rb', line 6 def initialize @dict = { }; File.open(File.join(File.dirname(__FILE__), "..", "asserts", "unicode_to_hanyu_pinyin.txt")).each_line do |line| code, = line.split @dict[code.to_i(16)] = [1..-2].split(",") end end |
Instance Attribute Details
#dict ⇒ Object
Returns the value of attribute dict.
5 6 7 |
# File 'lib/pinyin_resource.rb', line 5 def dict @dict end |