Class: WikibaseRepresentable::Model::Time

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

Overview

Represents a point in time.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(**kwargs) ⇒ Time

Returns a new instance of Time.



9
10
11
12
13
14
15
16
# File 'lib/wikibase_representable/model/time.rb', line 9

def initialize(**kwargs)
  @time = kwargs[:time]
  @time_zone = kwargs[:time_zone]
  @before = kwargs[:before]
  @after = kwargs[:after]
  @precision = kwargs[:precision]
  @calendar_model = kwargs[:calendar_model]
end

Instance Attribute Details

#after ⇒ Object

Returns the value of attribute after.



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

def after
  @after
end

#before ⇒ Object

Returns the value of attribute before.



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

def before
  @before
end

#calendar_model ⇒ Object

Returns the value of attribute calendar_model.



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

def calendar_model
  @calendar_model
end

#precision ⇒ Object

Returns the value of attribute precision.



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

def precision
  @precision
end

#time ⇒ Object

Returns the value of attribute time.



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

def time
  @time
end

#time_zone ⇒ Object

Returns the value of attribute time_zone.



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

def time_zone
  @time_zone
end

Instance Method Details

#==(other) ⇒ Object



22
23
24
# File 'lib/wikibase_representable/model/time.rb', line 22

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

#eql?(other) ⇒ Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/wikibase_representable/model/time.rb', line 26

def eql?(other)
  self == other
end

#state ⇒ Object



18
19
20
# File 'lib/wikibase_representable/model/time.rb', line 18

def state
  [time, time_zone, before, after, precision, calendar_model]
end