Module Comparable
In: lib/facet/comparable/at_least.rb
lib/facet/comparable/at_most.rb
lib/facet/comparable/bound_by.rb

Methods

at_least   at_most   bound_by  

Public Instance methods

Returns the lower of self or x.

  require 'facet/numeric/bound_by'

  4.at_least(5)  #=> 5
  6.at_least(5)  #=> 6

Returns the greater of self or x.

  require 'facet/numeric/bound_by'

  4.at_most(5)  #=> 4
  6.at_most(5)  #=> 5

Returns the value or the given upper or lower bound if the value falls outside of them.

  require 'facet/comparable/bound_by'

  4.bound_by(2,7)  #=> 4
  9.bound_by(2,7)  #=> 7
  1.bound_by(2,7)  #=> 2

[Validate]