Sha256: d9c3060f3dc5a9fa80e2eff74b4ee5582a6fde572adf8824872a7254bf45c6fc
Contents?: true
Size: 747 Bytes
Versions: 10
Compression:
Stored size: 747 Bytes
Contents
module OpenActive module Validators class FloatValidator < BaseValidator # Coerce given value to the type the validator is validating against. # PLEASE NOTE: no checks are performed on the given value. # It is therefore recommended to call the "run" method first before this. # # @param value [mixed] The value to coerce. # @return [float] The coerced value def coerce(value) value.to_f end # Run validation on the given value. # # @param value [mixed] The value to validate. # @return [Boolean] Whether validation passes or not. def run(value) Float(value) true rescue ArgumentError => _e false end end end end
Version data entries
10 entries across 10 versions & 1 rubygems