Class: WikibaseRepresentable::Model::PropertyValueSnak
- Inherits:
-
Object
- Object
- WikibaseRepresentable::Model::PropertyValueSnak
- 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
-
#data_value ⇒ Object
Returns the value of attribute data_value.
-
#hash ⇒ Object
Returns the value of attribute hash.
-
#property_id ⇒ Object
Returns the value of attribute property_id.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #eql?(other) ⇒ Boolean
-
#initialize(type: SNAK_TYPE, property_id: nil, data_value: nil, hash: nil) ⇒ PropertyValueSnak
constructor
A new instance of PropertyValueSnak.
- #state ⇒ Object
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_value ⇒ Object
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 |
#hash ⇒ Object
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_id ⇒ Object
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 |
#type ⇒ Object
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
29 30 31 |
# File 'lib/wikibase_representable/model/property_value_snak.rb', line 29 def eql?(other) self == other end |
#state ⇒ Object
21 22 23 |
# File 'lib/wikibase_representable/model/property_value_snak.rb', line 21 def state [type, property_id, data_value, hash] end |