Class: ActiveAttr::Typecasting::DateTypecaster
- Inherits:
-
Object
- Object
- ActiveAttr::Typecasting::DateTypecaster
- Defined in:
- lib/active_attr/typecasting/date_typecaster.rb
Overview
Typecasts an Object to a Date
Instance Method Summary collapse
-
#call(value) ⇒ Date?
Typecasts an object to a Date.
Instance Method Details
#call(value) ⇒ Date?
Typecasts an object to a Date
Attempts to convert using #to_date.
25 26 27 28 |
# File 'lib/active_attr/typecasting/date_typecaster.rb', line 25 def call(value) value.to_date if value.respond_to? :to_date rescue NoMethodError, ArgumentError end |