Sha256: 8185bb6151a69f8dbf5a76bac19cd24d7e8985d5e86ee6264e1d50ef34fa446a
Contents?: true
Size: 653 Bytes
Versions: 9
Compression:
Stored size: 653 Bytes
Contents
# Float objects represent inexact real numbers using the native architecture's double-precision floating point representation. # See: http://ruby-doc.org/core-2.1.0/Float.html module Attributor class Float include Numeric def self.native_type ::Float end def self.example(_context = nil, options: {}) min = options[:min].to_f || 0.0 max = options[:max].to_f || Math.PI rand * (max - min) + min end def self.load(value, context = Attributor::DEFAULT_ROOT_CONTEXT, **options) Float(value) rescue TypeError super end def self.json_schema_type :number end end end
Version data entries
9 entries across 9 versions & 1 rubygems