Sha256: 1b2713269269cc8c294d4970cded63813d39b19ec778a73044a141d3ca675188
Contents?: true
Size: 364 Bytes
Versions: 1
Compression:
Stored size: 364 Bytes
Contents
module Comparable # Clamps the value to a closed interval. # # Also see https://bugs.ruby-lang.org/issues/10594 # # @param [Comparable] low lower bound # @param [Comparable] high upper bound # @return [Comparable] value constrained to the bounds def clamp(low, high) return low if self < low return high if self > high self end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
casual_support-2.0.0 | lib/casual_support/comparable/clamp.rb |