Class: Attrio::Types::Date
- Inherits:
-
Base
show all
- Defined in:
- lib/attrio/types/date.rb
Class Method Summary
collapse
Methods inherited from Base
default_reader_aliases, default_writer_aliases
Class Method Details
.typecast(value, options = {}) ⇒ Object
6
7
8
9
10
11
12
|
# File 'lib/attrio/types/date.rb', line 6
def self.typecast(value, options = {})
begin
options[:format].present? ? ::Date.strptime(value.to_s, options[:format]) : ::Date.parse(value.to_s)
rescue ArgumentError => e
nil
end
end
|
.typecasted?(value, options = {}) ⇒ Boolean
14
15
16
|
# File 'lib/attrio/types/date.rb', line 14
def self.typecasted?(value, options = {})
value.is_a? ::Date
end
|