Sha256: 7c6e97829f59e1197c3dde26a5d4318c657f57f343f4e6a71f8c15719b684fcd
Contents?: true
Size: 1.29 KB
Versions: 6
Compression:
Stored size: 1.29 KB
Contents
module OData4 module Properties # Defines the Float OData4 type. class Float < OData4::Property include OData4::Properties::Number # Returns the property value, properly typecast # @return [Float,nil] def value if (@value.nil? || @value.empty?) && allows_nil? nil else @value.to_f end end # Sets the property value # @params new_value [to_f] def value=(new_value) validate(new_value.to_f) @value = new_value.to_f.to_s end # The OData4 type name def type 'Edm.Double' end private def min_value @min ||= -(1.7 * (10**308)) end def max_value @max ||= (1.7 * (10**308)) end end # Defines the Double (Float) OData4 type. class Double < OData4::Properties::Float; end # Defines the Single (Float) OData4 type. class Single < OData4::Properties::Float # The OData4 type name def type 'Edm.Single' end # Value to be used in URLs. # @return [String] def url_value "#{value}F" end private def min_value @min ||= -(3.4 * (10**38)) end def max_value @max ||= (3.4 * (10**38)) end end end end
Version data entries
6 entries across 6 versions & 1 rubygems