Sha256: 0eefd569c767cf7701de05f5438f3eb318b01f36eb22cac18bea40ab8db42106

Contents?: true

Size: 250 Bytes

Versions: 3

Compression:

Stored size: 250 Bytes

Contents

#--
# Credit goes to Florian Gross.
#++
class Numeric
  # Returns the greater of self or x.
  #
  #   require 'facet/numeric/bound_by'
  #
  #   4.at_most(5)  #=> 4
  #   6.at_most(5)  #=> 5
  #
  def at_most(x)
    (self <= x) ? self : x
  end
end 

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
facets-0.7.1 lib/facet/numeric/at_most.rb
facets-0.7.0 lib/facet/numeric/at_most.rb
facets-0.7.2 lib/facet/numeric/at_most.rb