Sha256: 21579e936bb8c5ecc7ff736b9010f8ac13df1be8bd475a499ddc6e18732db424

Contents?: true

Size: 265 Bytes

Versions: 1

Compression:

Stored size: 265 Bytes

Contents

module Comparable

  # Enforces an upper bound for the value.
  #
  # @param [Comparable] limit upper bound
  # @return [Comparable] value constrained by the upper bound
  def at_most(limit)
    self > limit ? limit : self
  end

  alias_method :cap, :at_most

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
casual_support-2.0.0 lib/casual_support/comparable/at_most.rb