lib/rice_bubble/attributes/date.rb in rice_bubble-0.1.2 vs lib/rice_bubble/attributes/date.rb in rice_bubble-0.2.0
- old
+ new
@@ -1,15 +1,13 @@
-require 'date'
-
module RiceBubble
class Attributes
class Date < Base
- def valid?(value)
- value.respond_to?(:to_date)
+ def call(value, path: '')
+ super(value.to_date, path:)
end
- def coerce(value)
- value.respond_to?(:to_date) ? value.to_date : value
+ def valid_types
+ [::Date, ::Time, ::DateTime]
end
end
end
end