Class: Eiwa::Tag::Meaning

Inherits:
Any
  • Object
show all
Defined in:
lib/eiwa/tag/meaning.rb

Instance Attribute Summary collapse

Attributes inherited from Any

#characters, #parent, #tag_name

Instance Method Summary collapse

Methods inherited from Any

#add_characters, #end_self, #start, #to_s

Constructor Details

#initializeMeaning

Returns a new instance of Meaning.



10
11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/eiwa/tag/meaning.rb', line 10

def initialize
  @parts_of_speech = []
  @definitions = []
  @misc_tags = []
  @cross_references = []
  @restricted_to_readings = []
  @restricted_to_spellings = []
  @antonyms = []
  @fields = []
  @source_languages = []
  @dialects = []
  @comments = []
end

Instance Attribute Details

#antonymsObject (readonly)

Returns the value of attribute antonyms.



6
7
8
# File 'lib/eiwa/tag/meaning.rb', line 6

def antonyms
  @antonyms
end

#commentsObject (readonly)

Returns the value of attribute comments.



6
7
8
# File 'lib/eiwa/tag/meaning.rb', line 6

def comments
  @comments
end

#cross_referencesObject (readonly)

Returns the value of attribute cross_references.



6
7
8
# File 'lib/eiwa/tag/meaning.rb', line 6

def cross_references
  @cross_references
end

#definitionsObject (readonly)

Returns the value of attribute definitions.



6
7
8
# File 'lib/eiwa/tag/meaning.rb', line 6

def definitions
  @definitions
end

#dialectsObject (readonly)

Returns the value of attribute dialects.



6
7
8
# File 'lib/eiwa/tag/meaning.rb', line 6

def dialects
  @dialects
end

#fieldsObject (readonly)

Returns the value of attribute fields.



6
7
8
# File 'lib/eiwa/tag/meaning.rb', line 6

def fields
  @fields
end

#misc_tagsObject (readonly)

Returns the value of attribute misc_tags.



6
7
8
# File 'lib/eiwa/tag/meaning.rb', line 6

def misc_tags
  @misc_tags
end

#parts_of_speechObject (readonly)

Returns the value of attribute parts_of_speech.



6
7
8
# File 'lib/eiwa/tag/meaning.rb', line 6

def parts_of_speech
  @parts_of_speech
end

#restricted_to_readingsObject (readonly)

Returns the value of attribute restricted_to_readings.



6
7
8
# File 'lib/eiwa/tag/meaning.rb', line 6

def restricted_to_readings
  @restricted_to_readings
end

#restricted_to_spellingsObject (readonly)

Returns the value of attribute restricted_to_spellings.



6
7
8
# File 'lib/eiwa/tag/meaning.rb', line 6

def restricted_to_spellings
  @restricted_to_spellings
end

#source_languagesObject (readonly)

Returns the value of attribute source_languages.



6
7
8
# File 'lib/eiwa/tag/meaning.rb', line 6

def source_languages
  @source_languages
end

Instance Method Details

#end_child(child) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/eiwa/tag/meaning.rb', line 24

def end_child(child)
  case child.tag_name
  when "pos"
    @parts_of_speech << child
  when "gloss"
    @definitions << child
  when "misc"
    @misc_tags << child
  when "field"
    @fields << child
  when "xref"
    @cross_references << child
  when "ant"
    @antonyms << child
  when "stagr"
    @restricted_to_readings << child.characters
  when "stagk"
    @restricted_to_spellings << child.characters
  when "lsource"
    @source_languages << child
  when "dial"
    @dialects << child
  when "s_inf"
    @comments << child.characters
  end
end

#trickle_down(previous) ⇒ Object



51
52
53
54
# File 'lib/eiwa/tag/meaning.rb', line 51

def trickle_down(previous)
  @parts_of_speech = previous.parts_of_speech if @parts_of_speech.empty?
  @misc_tags = previous.misc_tags if @misc_tags.empty?
end