Class: Graft::Xml::Type::Time

Inherits:
Graft::Xml::Type show all
Defined in:
lib/graft/xml/type.rb

Overview

Time

Instance Method Summary collapse

Methods inherited from Graft::Xml::Type

#convertible?, #initialize, #value

Constructor Details

This class inherits a constructor from Graft::Xml::Type

Instance Method Details

#convertObject



73
74
75
# File 'lib/graft/xml/type.rb', line 73

def convert
  timestamp? ? ::Time.at(@source.to_i) : ::Time.parse(@source)
end

#timestamp?Boolean

Returns:



69
70
71
# File 'lib/graft/xml/type.rb', line 69

def timestamp?
  !@source.match(/^\d+$/).nil?
end