class Ctc::Ctc2Kanji

Public Class Methods

find(kanji) click to toggle source
# File lib/ctc/ctc_2_kanji.rb, line 3
def self.find(kanji)
  mappings.fetch(kanji) do
    raise Ctc::CtcNotFoundError.new("China Telelgraph Code (CTC) not found.")
  end
end

Private Class Methods

mappings() click to toggle source
# File lib/ctc/ctc_2_kanji.rb, line 10
def self.mappings
  return @mappings if @mappings

  yaml_file = File.expand_path("../../config/ctc_2_kanji.yml", File.dirname(__FILE__))
  @mappings = YAML.load_file(yaml_file)
  @mappings
end