Sha256: 696a9687fb30be4bac67dd275ceae9b7faefdd3c9dc878775748864d91f7fe73

Contents?: true

Size: 255 Bytes

Versions: 10

Compression:

Stored size: 255 Bytes

Contents

# frozen_string_literal: true

module ValidateParams
  class Types
    class Float
      def self.valid?(value)
        /\A[-+]?\d+(\.\d+)?\z/ === value.to_s
      end

      def self.cast(raw_value, **)
        raw_value.to_f
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
validate-params-0.14.0 lib/validate_params/types/float.rb
validate-params-0.13.1 lib/validate_params/types/float.rb
validate-params-0.13.0 lib/validate_params/types/float.rb
validate-params-0.12.5 lib/validate_params/types/float.rb
validate-params-0.12.4 lib/validate_params/types/float.rb
validate-params-0.12.3 lib/validate_params/types/float.rb
validate-params-0.12.2 lib/validate_params/types/float.rb
validate-params-0.12.1 lib/validate_params/types/float.rb
validate-params-0.12.0 lib/validate_params/types/float.rb
validate-params-0.11.0 lib/validate_params/types/float.rb