Class: OData::Properties::Integer

Inherits:
OData::Property show all
Includes:
Number
Defined in:
lib/odata/properties/integer.rb

Overview

Defines the Integer OData type.

Direct Known Subclasses

Byte, Int16, Int32, Int64, SByte

Instance Attribute Summary

Attributes inherited from OData::Property

#name

Instance Method Summary collapse

Methods inherited from OData::Property

#==, #allows_nil?, #concurrency_mode, #initialize, #to_xml, #url_value, #xml_value

Constructor Details

This class inherits a constructor from OData::Property

Instance Method Details

#typeObject

The OData type name



25
26
27
# File 'lib/odata/properties/integer.rb', line 25

def type
  'Edm.Int64'
end

#valueInteger?

Returns the property value, properly typecast

Returns:



9
10
11
12
13
14
15
# File 'lib/odata/properties/integer.rb', line 9

def value
  if (@value.nil? || @value.empty?) && allows_nil?
    nil
  else
    @value.to_i
  end
end

#value=(new_value) ⇒ Object

Sets the property value



19
20
21
22
# File 'lib/odata/properties/integer.rb', line 19

def value=(new_value)
  validate(new_value.to_i)
  @value = new_value.to_i.to_s
end