Sha256: 4bf5519d67ee93f88f084abb6be093d48045b97abdbf184dd5369c155aedbd14

Contents?: true

Size: 254 Bytes

Versions: 3

Compression:

Stored size: 254 Bytes

Contents

#--
# Credit goes to Florian Gross.
#++
module Comparable
  # 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.0 lib/facet/comparable/at_most.rb
facets-0.7.1 lib/facet/comparable/at_most.rb
facets-0.7.2 lib/facet/comparable/at_most.rb