Class: Frodo::Properties::Integer
- Inherits:
-
Frodo::Property
- Object
- Frodo::Property
- Frodo::Properties::Integer
- Includes:
- Number
- Defined in:
- lib/frodo/properties/integer.rb
Overview
Defines the Integer Frodo type.
Instance Attribute Summary
Attributes inherited from Frodo::Property
Instance Method Summary collapse
-
#type ⇒ Object
The Frodo type name.
-
#value ⇒ Integer?
Returns the property value, properly typecast.
-
#value=(new_value) ⇒ Object
Sets the property value.
Methods inherited from Frodo::Property
#==, #allows_nil?, #concurrency_mode, from_xml, #initialize, #json_value, #strict?, #to_xml, #url_value, #xml_value
Constructor Details
This class inherits a constructor from Frodo::Property
Instance Method Details
#type ⇒ Object
The Frodo type name
29 30 31 |
# File 'lib/frodo/properties/integer.rb', line 29 def type 'Edm.Int64' end |
#value ⇒ Integer?
Returns the property value, properly typecast
9 10 11 12 13 14 15 |
# File 'lib/frodo/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 23 24 25 26 |
# File 'lib/frodo/properties/integer.rb', line 19 def value=(new_value) validate(new_value.to_i) @value = if new_value.nil? && allows_nil? nil else new_value.to_i.to_s end end |