Class: WikibaseRepresentable::Model::TimeValue

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

Overview

Data value object that represents a time value.

Constant Summary collapse

TYPE =
'time'

Instance Attribute Summary

Attributes inherited from DataValue

#type, #value

Instance Method Summary collapse

Constructor Details

#initialize(value: nil) ⇒ TimeValue

Returns a new instance of TimeValue.



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

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

Instance Method Details

#==(other) ⇒ Object



43
44
45
# File 'lib/wikibase_representable/model/time_value.rb', line 43

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

#after ⇒ Object



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

def after
  value.after
end

#before ⇒ Object



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

def before
  value.before
end

#calendar_model ⇒ Object



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

def calendar_model
  value.calendar_model
end

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


47
48
49
# File 'lib/wikibase_representable/model/time_value.rb', line 47

def eql?(other)
  self == other
end

#precision ⇒ Object



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

def precision
  value.precision
end

#state ⇒ Object



39
40
41
# File 'lib/wikibase_representable/model/time_value.rb', line 39

def state
  [type, value]
end

#time ⇒ Object



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

def time
  value.time
end

#time_zone ⇒ Object



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

def time_zone
  value.time_zone
end