Class: KLookup::Database::Unihan

Inherits:
KLookup::Database show all
Includes:
Singleton
Defined in:
lib/klookup/database_unihan.rb

Overview

A singleton class to access Unihan.txt.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.open_resource(path) ⇒ Object

Opens a resource.

Priority: LOOKUP_PATH environment variable, Gem load path.



57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/klookup/database_unihan.rb', line 57

def self.open_resource(path)
  # Choose a directory
  env=ENV['KLOOKUP_PATH']
  if env and env != ''
    dir=env+'/unihan'
  else
    dir=gem_path
    begin
      gem 'unihan'
      dir=Gem.datadir 'unihan'
    rescue NameError
      raise IOError, 'Could not find resource %s' % path
    end
  end

  # Open a file
  file = open("#{dir}/#{path}")
  if block_given?
    yield file
  else
    return file
  end
end

Instance Method Details

#get_kanji(strokes, *args) ⇒ Object



85
86
# File 'lib/klookup/database_unihan.rb', line 85

def get_kanji(strokes, *args)
end

#get_kanji_strokes(*args) ⇒ Object



89
90
# File 'lib/klookup/database_unihan.rb', line 89

def get_kanji_strokes(*args)
end

#get_meaning(*args) ⇒ Object



95
96
# File 'lib/klookup/database_unihan.rb', line 95

def get_meaning(*args)
end

#get_radical_strokes(*args) ⇒ Object



87
88
# File 'lib/klookup/database_unihan.rb', line 87

def get_radical_strokes(*args)
end

#get_radicals(*args) ⇒ Object



91
92
# File 'lib/klookup/database_unihan.rb', line 91

def get_radicals(*args)
end

#get_reading(*args) ⇒ Object



93
94
# File 'lib/klookup/database_unihan.rb', line 93

def get_reading(*args)
end

#is_kanji?(*args) ⇒ Boolean

Returns:

  • (Boolean)


97
98
# File 'lib/klookup/database_unihan.rb', line 97

def is_kanji?(*args)
end

#is_radical?(*args) ⇒ Boolean

Returns:

  • (Boolean)


99
100
# File 'lib/klookup/database_unihan.rb', line 99

def is_radical?(*args)
end

#radicals_by_strokesObject



83
84
# File 'lib/klookup/database_unihan.rb', line 83

def radicals_by_strokes
end

#stroke_count_list(*args) ⇒ Object



81
82
# File 'lib/klookup/database_unihan.rb', line 81

def stroke_count_list(*args)
end