Class: Langue::Word

Inherits:
Array
  • Object
show all
Defined in:
lib/langue/word.rb

Instance Method Summary collapse

Instance Method Details

#inflectionObject



21
22
23
24
# File 'lib/langue/word.rb', line 21

def inflection
  @inflection = value_in_key_morpheme(:inflection) unless instance_variable_defined?(:@inflection)
  @inflection
end

#inflection_typeObject



26
27
28
29
# File 'lib/langue/word.rb', line 26

def inflection_type
  @inflection_type = value_in_key_morpheme(:inflection_type) unless instance_variable_defined?(:@inflection_type)
  @inflection_type
end

#morphemesObject



10
11
12
# File 'lib/langue/word.rb', line 10

def morphemes
  @morphemes ||= Morphemes.new(self)
end

#pronunciationObject



41
42
43
44
# File 'lib/langue/word.rb', line 41

def pronunciation
  @pronunciation = join_values(:pronunciation) unless instance_variable_defined?(:@pronunciation)
  @pronunciation
end

#root_formObject



31
32
33
34
# File 'lib/langue/word.rb', line 31

def root_form
  @root_form = not_empty? { self[0..-2].map(&:text) + self[-1, 1].map(&:root_form) } unless instance_variable_defined?(:@root_form)
  @root_form
end

#textObject



16
17
18
19
# File 'lib/langue/word.rb', line 16

def text
  @text = not_empty? { map(&:text) } unless instance_variable_defined?(:@text)
  @text
end

#valid?Boolean

Returns:

  • (Boolean)


6
7
8
# File 'lib/langue/word.rb', line 6

def valid?
  all? { |morpheme| Morpheme === morpheme }
end

#yomiObject



36
37
38
39
# File 'lib/langue/word.rb', line 36

def yomi
  @yomi = join_values(:yomi) unless instance_variable_defined?(:@yomi)
  @yomi
end