Class: Renshuu::Kanji
Overview
Defined Under Namespace
Classes: RelatedWord
Instance Attribute Summary collapse
Class Method Summary
collapse
Methods included from Listable
#add_to_list, included, #remove_from_list
#add_to_schedule, included, #remove_from_schedule
Instance Attribute Details
#definition ⇒ String
47
|
# File 'lib/renshuu/models/kanji.rb', line 47
attribute :definition, Types::String
|
#id ⇒ String
39
|
# File 'lib/renshuu/models/kanji.rb', line 39
attribute :id, Types::String
|
#jlpt ⇒ String?
76
|
# File 'lib/renshuu/models/kanji.rb', line 76
attribute? :jlpt, Types::String
|
#kanji ⇒ String
43
|
# File 'lib/renshuu/models/kanji.rb', line 43
attribute :kanji, Types::String
|
#kanken ⇒ String?
72
|
# File 'lib/renshuu/models/kanji.rb', line 72
attribute? :kanken, Types::String
|
#kunyomi ⇒ String?
68
|
# File 'lib/renshuu/models/kanji.rb', line 68
attribute? :kunyomi, Types::String
|
#onyomi ⇒ String?
64
|
# File 'lib/renshuu/models/kanji.rb', line 64
attribute? :onyomi, Types::String
|
111
|
# File 'lib/renshuu/models/kanji.rb', line 111
attribute? :presence, Presence
|
#radical ⇒ String?
56
|
# File 'lib/renshuu/models/kanji.rb', line 56
attribute? :radical, Types::String
|
#radical_name ⇒ String?
60
|
# File 'lib/renshuu/models/kanji.rb', line 60
attribute? :radical_name, Types::String
|
103
|
# File 'lib/renshuu/models/kanji.rb', line 103
attribute? :rwords, Types::Array.of(RelatedWord)
|
#scount ⇒ Integer?
Also known as:
stroke_count
51
|
# File 'lib/renshuu/models/kanji.rb', line 51
attribute? :scount, Types::Integer
|
107
|
# File 'lib/renshuu/models/kanji.rb', line 107
attribute? :user_data, UserData
|
Class Method Details
.get(character) ⇒ Kanji
Retrieves a kanji from Renshuu’s dictionary.
30
31
32
33
34
|
# File 'lib/renshuu/models/kanji.rb', line 30
def self.get(character)
cgi_character = CGI.escape(character)
body = Renshuu.client.query(:get, "v1/kanji/#{cgi_character}")
new(body)
end
|
.search(value) ⇒ Array<Kanji>
Searches the Renshuu kanji dictionary.
18
19
20
21
22
|
# File 'lib/renshuu/models/kanji.rb', line 18
def self.search(value)
body = Renshuu.client.query(:get, 'v1/kanji/search', params: { value: })
body.fetch(:kanjis).map { Kanji.new(_1) }
end
|