Class: WikibaseRepresentable::Model::EntityIdValue

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

Overview

Data value representing an entity ID data value

Constant Summary collapse

TYPE =
'wikibase-entityid'

Instance Attribute Summary

Attributes inherited from DataValue

#type, #value

Instance Method Summary collapse

Constructor Details

#initialize(value: nil) ⇒ EntityIdValue

Returns a new instance of EntityIdValue.



11
12
13
# File 'lib/wikibase_representable/model/entity_id_value.rb', line 11

def initialize(value: nil)
  super(type: TYPE, value: value)
end

Instance Method Details

#==(other) ⇒ Object



31
32
33
# File 'lib/wikibase_representable/model/entity_id_value.rb', line 31

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

#entity_typeObject



19
20
21
# File 'lib/wikibase_representable/model/entity_id_value.rb', line 19

def entity_type
  value.entity_type
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


35
36
37
# File 'lib/wikibase_representable/model/entity_id_value.rb', line 35

def eql?(other)
  self == other
end

#idObject



15
16
17
# File 'lib/wikibase_representable/model/entity_id_value.rb', line 15

def id
  value.id
end

#numeric_idObject



23
24
25
# File 'lib/wikibase_representable/model/entity_id_value.rb', line 23

def numeric_id
  value.numeric_id
end

#stateObject



27
28
29
# File 'lib/wikibase_representable/model/entity_id_value.rb', line 27

def state
  [type, value]
end