Sha256: 782c9a303138a9e0e5e86f3858749da8abdd4aaeb99e55646340d87009992011

Contents?: true

Size: 242 Bytes

Versions: 35

Compression:

Stored size: 242 Bytes

Contents

module PushType
  module Primitives
    class NumberType < Base

      def to_json
        unless value.blank? || value.to_s !~ /^[\+\-]?\d+/
          (f = value.to_f) && (f % 1.0 == 0) ? f.to_i : f
        end
      end

    end
  end
end

Version data entries

35 entries across 35 versions & 1 rubygems

Version Path
push_type_core-0.12.1 lib/push_type/primitives/number_type.rb
push_type_core-0.12.0 lib/push_type/primitives/number_type.rb
push_type_core-0.12.0.beta.1 lib/push_type/primitives/number_type.rb
push_type_core-0.11.2 lib/push_type/primitives/number_type.rb
push_type_core-0.11.1 lib/push_type/primitives/number_type.rb
push_type_core-0.11.0.beta.2 lib/push_type/primitives/number_type.rb
push_type_core-0.11.0.beta.1 lib/push_type/primitives/number_type.rb
push_type_core-0.10.4 lib/push_type/primitives/number_type.rb
push_type_core-0.10.3 lib/push_type/primitives/number_type.rb
push_type_core-0.10.2 lib/push_type/primitives/number_type.rb
push_type_core-0.10.1 lib/push_type/primitives/number_type.rb
push_type_core-0.10.0 lib/push_type/primitives/number_type.rb
push_type_core-0.10.0.beta.5 lib/push_type/primitives/number_type.rb
push_type_core-0.10.0.beta.3 lib/push_type/primitives/number_type.rb
push_type_core-0.9.5 lib/push_type/primitives/number_type.rb
push_type_core-0.9.3 lib/push_type/primitives/number_type.rb
push_type_core-0.9.2 lib/push_type/primitives/number_type.rb
push_type_core-0.9.1 lib/push_type/primitives/number_type.rb
push_type_core-0.9.0 lib/push_type/primitives/number_type.rb
push_type_core-0.9.0.beta.4 lib/push_type/primitives/number_type.rb