Class: WikibaseRepresentable::Model::DataValue

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

Overview

Object that represents a single data value.

Direct Known Subclasses

EntityIdValue, TimeValue

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type: nil, value: nil) ⇒ DataValue

Returns a new instance of DataValue.



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

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

Instance Attribute Details

#typeObject

Returns the value of attribute type.



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

def type
  @type
end

#valueObject

Returns the value of attribute value.



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

def value
  @value
end

Instance Method Details

#==(other) ⇒ Object



18
19
20
# File 'lib/wikibase_representable/model/data_value.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/data_value.rb', line 22

def eql?(other)
  self == other
end

#stateObject



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

def state
  [type, value]
end