Sha256: 043525f13fcfa60652e5f90b91be3da61f3ff3a97e4e6c4b0e287c6781d2e9a1

Contents?: true

Size: 386 Bytes

Versions: 1

Compression:

Stored size: 386 Bytes

Contents

# frozen_string_literal: true

module TJSON
  class DataType
    # Floating point type
    class Float < Number
      def tag
        "f"
      end

      def convert(float)
        raise TJSON::TypeError, "not a floating point value: #{float.inspect}" unless float.is_a?(::Numeric)
        float.to_f
      end

      def generate(float)
        float.to_f
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
tjson-0.4.0 lib/tjson/datatype/float.rb