Class: WikibaseRepresentable::Model::EntityId

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

Overview

Data value representing an entity ID data value

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id: nil, numeric_id: nil, entity_type: nil) ⇒ EntityId

Returns a new instance of EntityId.



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

def initialize(id: nil, numeric_id: nil, entity_type: nil)
  @id = id
  @numeric_id = numeric_id
  @entity_type = entity_type
end

Instance Attribute Details

#entity_typeObject

Returns the value of attribute entity_type.



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

def entity_type
  @entity_type
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#numeric_idObject

Returns the value of attribute numeric_id.



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

def numeric_id
  @numeric_id
end

Instance Method Details

#==(other) ⇒ Object



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

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

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


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

def eql?(other)
  self == other
end

#stateObject



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

def state
  [id, numeric_id, entity_type]
end