Module: MonoclePrint::Utils
- Defined in:
- lib/monocle-print/utils.rb
Class Method Summary collapse
- .at_least(comparable, min) ⇒ Object
- .at_most(comparable, max) ⇒ Object
- .bound(comparable, lower, upper = nil) ⇒ Object
Class Method Details
.at_least(comparable, min) ⇒ Object
8 9 10 |
# File 'lib/monocle-print/utils.rb', line 8 def at_least( comparable, min ) ( comparable >= min ) ? comparable : min end |
.at_most(comparable, max) ⇒ Object
12 13 14 |
# File 'lib/monocle-print/utils.rb', line 12 def at_most( comparable, max ) ( comparable <= max ) ? comparable : max end |
.bound(comparable, lower, upper = nil) ⇒ Object
16 17 18 19 20 21 |
# File 'lib/monocle-print/utils.rb', line 16 def bound( comparable, lower, upper = nil ) return lower if comparable < lower return comparable unless upper return upper if comparable > upper return comparable end |