Class: WikibaseRepresentable::Model::PropertyValueSnak

Inherits:
Object
  • Object
show all
Includes:
SnakDataValueHelper
Defined in:
lib/wikibase_representable/model/property_value_snak.rb

Overview

Class representing a property value snak. See www.mediawiki.org/wiki/Wikibase/DataModel#PropertyValueSnak

Constant Summary collapse

SNAK_TYPE =
'value'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from SnakDataValueHelper

#entity_id_value, #time_value, #value_type?

Constructor Details

#initialize(type: SNAK_TYPE, property_id: nil, data_value: nil, hash: nil) ⇒ PropertyValueSnak

Returns a new instance of PropertyValueSnak.



14
15
16
17
18
19
# File 'lib/wikibase_representable/model/property_value_snak.rb', line 14

def initialize(type: SNAK_TYPE, property_id: nil, data_value: nil, hash: nil)
  @type = type
  @property_id = property_id
  @data_value = data_value
  @hash = hash
end

Instance Attribute Details

#data_valueObject

Returns the value of attribute data_value.



12
13
14
# File 'lib/wikibase_representable/model/property_value_snak.rb', line 12

def data_value
  @data_value
end

#hashObject

Returns the value of attribute hash.



12
13
14
# File 'lib/wikibase_representable/model/property_value_snak.rb', line 12

def hash
  @hash
end

#property_idObject

Returns the value of attribute property_id.



12
13
14
# File 'lib/wikibase_representable/model/property_value_snak.rb', line 12

def property_id
  @property_id
end

#typeObject

Returns the value of attribute type.



12
13
14
# File 'lib/wikibase_representable/model/property_value_snak.rb', line 12

def type
  @type
end

Instance Method Details

#==(other) ⇒ Object



25
26
27
# File 'lib/wikibase_representable/model/property_value_snak.rb', line 25

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

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


29
30
31
# File 'lib/wikibase_representable/model/property_value_snak.rb', line 29

def eql?(other)
  self == other
end

#stateObject



21
22
23
# File 'lib/wikibase_representable/model/property_value_snak.rb', line 21

def state
  [type, property_id, data_value, hash]
end