Class: Eiwa::Tag::SourceLanguage

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

Instance Attribute Summary collapse

Attributes inherited from Any

#characters, #parent, #tag_name

Instance Method Summary collapse

Methods inherited from Any

#add_characters, #end_child, #start, #to_s

Constructor Details

#initialize(text: nil, language: "eng", wasei: false, type: "full") ⇒ SourceLanguage

Returns a new instance of SourceLanguage.



6
7
8
9
10
11
# File 'lib/eiwa/tag/source_language.rb', line 6

def initialize(text: nil, language: "eng", wasei: false, type: "full")
  @text = text
  @language = language
  @wasei = wasei
  @type = type
end

Instance Attribute Details

#languageObject (readonly)

Returns the value of attribute language.



4
5
6
# File 'lib/eiwa/tag/source_language.rb', line 4

def language
  @language
end

#textObject (readonly)

Returns the value of attribute text.



4
5
6
# File 'lib/eiwa/tag/source_language.rb', line 4

def text
  @text
end

#typeObject (readonly)

Returns the value of attribute type.



4
5
6
# File 'lib/eiwa/tag/source_language.rb', line 4

def type
  @type
end

#waseiObject (readonly)

Returns the value of attribute wasei.



4
5
6
# File 'lib/eiwa/tag/source_language.rb', line 4

def wasei
  @wasei
end

Instance Method Details

#end_selfObject



13
14
15
16
17
18
# File 'lib/eiwa/tag/source_language.rb', line 13

def end_self
  @text = @characters
  @language = @attrs["xml:lang"]
  @wasei = @attrs["ls_wasei"] == "y"
  @type = @attrs["ls_type"] || "full"
end

#eql?(other) ⇒ Boolean Also known as: ==

Returns:

  • (Boolean)


20
21
22
23
24
25
# File 'lib/eiwa/tag/source_language.rb', line 20

def eql?(other)
  @text == other.text &&
    @language == other.language &&
    @wasei == other.wasei &&
    @type == other.type
end

#hashObject



28
29
30
# File 'lib/eiwa/tag/source_language.rb', line 28

def hash
  [@text, @language, @wasei, @type].hash
end