Class: Yogurt::Converters::Time

Inherits:
Object
  • Object
show all
Extended by:
T::Sig, ScalarConverter
Defined in:
lib/yogurt/converters.rb

Class Method Summary collapse

Methods included from ScalarConverter

deserialize, serialize, type_alias

Class Method Details

.deserialize(raw_value) ⇒ Object



43
44
45
46
47
# File 'lib/yogurt/converters.rb', line 43

def self.deserialize(raw_value)
  raise "Unexpected value returned for Time: #{raw_value.inspect}" if !raw_value.is_a?(String)

  ::Time.iso8601(raw_value)
end

.serialize(value) ⇒ Object



38
39
40
# File 'lib/yogurt/converters.rb', line 38

def self.serialize(value)
  value.iso8601
end

.type_aliasObject



33
34
35
# File 'lib/yogurt/converters.rb', line 33

def self.type_alias
  T.type_alias {::Time}
end