Sha256: 5dc58ac2fcfc67a77183237304815b37f8849a27d58d9b57cb3c8ee48ad12cd0
Contents?: true
Size: 575 Bytes
Versions: 4
Compression:
Stored size: 575 Bytes
Contents
module Dry module Types module Coercions EMPTY_STRING = ''.freeze def to_nil(input) input unless empty_str?(input) end def to_date(input) Date.parse(input) rescue ArgumentError input end def to_date_time(input) DateTime.parse(input) rescue ArgumentError input end def to_time(input) Time.parse(input) rescue ArgumentError input end private def empty_str?(value) EMPTY_STRING.eql?(value) end end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
dry-types-0.8.1 | lib/dry/types/coercions.rb |
dry-types-0.8.0 | lib/dry/types/coercions.rb |
dry-types-0.7.2 | lib/dry/types/coercions.rb |
dry-types-0.7.1 | lib/dry/types/coercions.rb |