Class: OData::DateType
Instance Method Summary
collapse
Methods inherited from Type
#collection?, #initialize
Constructor Details
This class inherits a constructor from OData::Type
Instance Method Details
#coerce(value) ⇒ Object
7
8
9
10
11
12
13
14
15
16
17
|
# File 'lib/odata/types/primitive_types/date_type.rb', line 7
def coerce(value)
begin
if Date === value
value
else
Date.parse(value.to_s)
end
rescue ArgumentError
raise TypeError.new("Cannot convert #{value.inspect} into a date")
end
end
|
#name ⇒ Object
19
20
21
|
# File 'lib/odata/types/primitive_types/date_type.rb', line 19
def name
"Edm.Date"
end
|
#valid_value?(value) ⇒ Boolean
3
4
5
|
# File 'lib/odata/types/primitive_types/date_type.rb', line 3
def valid_value?(value)
Date === value
end
|