Sha256: 9eef612d79f87a0ee05b476ea34219b034af7e00abf9afadccd5b612681ec5a1
Contents?: true
Size: 482 Bytes
Versions: 1
Compression:
Stored size: 482 Bytes
Contents
module RiceBubble class Attributes class Time < Base def valid?(value) return false unless valid_time?(value) value.respond_to?(:to_time) end def coerce(value) return nil unless valid_time?(value) value end private def valid_time?(value) case value when ::DateTime then true when ::Date then false else value.respond_to?(:to_time) end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rice_bubble-0.2.1 | lib/rice_bubble/attributes/time.rb |