Class: Yogurt::Converters::Date

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



21
22
23
24
25
# File 'lib/yogurt/converters.rb', line 21

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

  ::Date.iso8601(raw_value)
end

.serialize(value) ⇒ Object



16
17
18
# File 'lib/yogurt/converters.rb', line 16

def self.serialize(value)
  value.iso8601
end

.type_aliasObject



11
12
13
# File 'lib/yogurt/converters.rb', line 11

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