Class: Wikidata::DataValues::Time

Inherits:
Value show all
Defined in:
lib/wikidata/datavalues/time.rb

Instance Attribute Summary

Attributes inherited from HashedObject

#data_hash

Instance Method Summary collapse

Methods inherited from Value

#resolve!, #resolved

Methods inherited from HashedObject

#initialize, #method_missing

Constructor Details

This class inherits a constructor from Wikidata::HashedObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Wikidata::HashedObject

Instance Method Details

#to_sObject



9
10
11
# File 'lib/wikidata/datavalues/time.rb', line 9

def to_s
  to_time.iso8601
end

#to_timeObject



5
6
7
# File 'lib/wikidata/datavalues/time.rb', line 5

def to_time
  DateTime.parse(data_hash.time)
end