Class: Renshuu::Word
Overview
Model class for words and vocabulary.
Instance Attribute Summary collapse
Class Method Summary
collapse
Instance Method Summary
collapse
Methods included from Listable
#add_to_list, included, #remove_from_list
#add_to_schedule, included, #remove_from_schedule
Instance Attribute Details
#def ⇒ Array<String>
69
|
# File 'lib/renshuu/models/word.rb', line 69
attribute :def, Types::Array.of(Types::String)
|
#hiragana_full ⇒ String
47
|
# File 'lib/renshuu/models/word.rb', line 47
attribute :hiragana_full, Types::String
|
#id ⇒ String
39
|
# File 'lib/renshuu/models/word.rb', line 39
attribute :id, Types::String
|
#kanji_full ⇒ String
43
|
# File 'lib/renshuu/models/word.rb', line 43
attribute :kanji_full, Types::String
|
#markers ⇒ Array<String>
56
|
# File 'lib/renshuu/models/word.rb', line 56
attribute(:markers, Types::Array.of(Types::String).default { [] })
|
#pic ⇒ Array<URI>
Also known as:
pictures
51
|
# File 'lib/renshuu/models/word.rb', line 51
attribute(:pic, Types::Array.of(Types::URI).default { [] })
|
#pitch ⇒ Array<String>
60
|
# File 'lib/renshuu/models/word.rb', line 60
attribute :pitch, Types::Array.of(Types::String)
|
78
|
# File 'lib/renshuu/models/word.rb', line 78
attribute? :presence, Presence
|
#typeofspeech ⇒ String
Also known as:
type_of_speech
64
|
# File 'lib/renshuu/models/word.rb', line 64
attribute :typeofspeech, Types::String
|
74
|
# File 'lib/renshuu/models/word.rb', line 74
attribute? :user_data, UserData
|
Class Method Details
.get(id) ⇒ Word
Retrieves a word from the dictionary by its identifier.
30
31
32
33
34
|
# File 'lib/renshuu/models/word.rb', line 30
def self.get(id)
body = Renshuu.client.query(:get, "v1/word/#{id}")
body.fetch(:words).first.then { new(_1) }
end
|
.search(value) ⇒ Array<Word>
Searches the Renshuu vocabulary dictionary.
18
19
20
21
22
|
# File 'lib/renshuu/models/word.rb', line 18
def self.search(value)
body = Renshuu.client.query(:get, 'v1/word/search', params: { value: })
body.fetch(:words).map { new(_1) }
end
|
Instance Method Details
#sentences ⇒ Array<Sentence>
Retrieves sentences using this word from the dictionary.
86
87
88
|
# File 'lib/renshuu/models/word.rb', line 86
def sentences
Sentence.word_search(self)
end
|