Module: Comparable
- Defined in:
- lib/casual_support/comparable/at_most.rb,
lib/casual_support/comparable/at_least.rb
Instance Method Summary collapse
-
#at_least(limit) ⇒ Comparable
Enforces a lower bound for the value.
-
#at_most(limit) ⇒ Comparable
(also: #cap)
Enforces an upper bound for the value.
Instance Method Details
#at_least(limit) ⇒ Comparable
Enforces a lower bound for the value.
11 12 13 |
# File 'lib/casual_support/comparable/at_least.rb', line 11 def at_least(limit) self < limit ? limit : self end |
#at_most(limit) ⇒ Comparable Also known as: cap
Enforces an upper bound for the value.
11 12 13 |
# File 'lib/casual_support/comparable/at_most.rb', line 11 def at_most(limit) self > limit ? limit : self end |