Sha256: eb86982b442e7a04560b4851dabf90c48ee490f5685c6393509f959776c7c0dc
Contents?: true
Size: 590 Bytes
Versions: 1
Compression:
Stored size: 590 Bytes
Contents
module RiceBubble class Attributes class Datetime < Base def valid?(value) return false unless valid_datetime?(value) value.respond_to?(:to_datetime) end def coerce(value) return nil unless valid_datetime?(value) value.respond_to?(:to_datetime) ? value.to_datetime : value end private def valid_datetime?(value) case value when ::Time then true when ::DateTime then true when ::Date then false else value.respond_to?(:to_datetime) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rice_bubble-0.1.2 | lib/rice_bubble/attributes/datetime.rb |