Sha256: 2664d98d0fc69d8934c4740ad85172b4d38476dcc106d8f4bf5052ac778531db

Contents?: true

Size: 430 Bytes

Versions: 3

Compression:

Stored size: 430 Bytes

Contents

module OData
  class DateType < PrimitiveType
    def valid_value?(value)
      Date === value
    end

    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

    def name
      "Edm.Date"
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
microsoft_graph-0.1.3 lib/odata/types/primitive_types/date_type.rb
microsoft_graph-0.1.1 lib/odata/types/primitive_types/date_type.rb
microsoft_graph-0.1.0 lib/odata/types/primitive_types/date_type.rb