Sha256: 227a4f653b923da8fe533192eb19fe2c0083e317e2993db9fbc287e0c505792d
Contents?: true
Size: 815 Bytes
Versions: 1
Compression:
Stored size: 815 Bytes
Contents
module Polyfill module V2_4 module Comparable module Instance module Clamp module Method def clamp(min, max) if min > max raise ArgumentError, 'min argument must be smaller than max argument' end return min if min > self return max if max < self self end end if RUBY_VERSION < '2.4.0' refine ::Numeric do include Method end refine ::String do include Method end refine ::Time do include Method end def self.included(base) base.include Method end end end end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
polyfill-0.3.0 | lib/polyfill/v2_4/comparable/instance/clamp.rb |