Class: OData::DoubleType

Inherits:
PrimitiveType show all
Defined in:
lib/odata/types/primitive_types/double_type.rb

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

Raises:

  • (TypeError)

7
8
9
10
# File 'lib/odata/types/primitive_types/double_type.rb', line 7

def coerce(value)
  raise TypeError.new("Cannot convert #{value.inspect} into a float") unless value.respond_to? :to_f
  value.to_f
end

#nameObject


12
13
14
# File 'lib/odata/types/primitive_types/double_type.rb', line 12

def name
  "Edm.Double"
end

#valid_value?(value) ⇒ Boolean


3
4
5
# File 'lib/odata/types/primitive_types/double_type.rb', line 3

def valid_value?(value)
  Numeric === value
end