Class: WikibaseRepresentable::Model::Term

Inherits:
Object
  • Object
show all
Defined in:
lib/wikibase_representable/model/term.rb

Overview

Represents a string value specific to a langugage code.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(language_code: nil, value: nil) ⇒ Term

Returns a new instance of Term.



9
10
11
12
# File 'lib/wikibase_representable/model/term.rb', line 9

def initialize(language_code: nil, value: nil)
  @language_code = language_code
  @value = value
end

Instance Attribute Details

#language_codeObject

Returns the value of attribute language_code.



7
8
9
# File 'lib/wikibase_representable/model/term.rb', line 7

def language_code
  @language_code
end

#valueObject

Returns the value of attribute value.



7
8
9
# File 'lib/wikibase_representable/model/term.rb', line 7

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



18
19
20
# File 'lib/wikibase_representable/model/term.rb', line 18

def ==(other)
  other.class == self.class && other.state == state
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/wikibase_representable/model/term.rb', line 22

def eql?(other)
  self == other
end

#stateObject



14
15
16
# File 'lib/wikibase_representable/model/term.rb', line 14

def state
  [language_code, value]
end