Class: Boundy::Bound::Constrainer
- Inherits:
-
Object
- Object
- Boundy::Bound::Constrainer
- Defined in:
- lib/boundy/bound/constrainer.rb
Instance Method Summary collapse
-
#initialize(a, b) ⇒ Constrainer
constructor
A new instance of Constrainer.
- #max ⇒ Object
- #min ⇒ Object
Constructor Details
#initialize(a, b) ⇒ Constrainer
Returns a new instance of Constrainer.
6 7 8 9 10 |
# File 'lib/boundy/bound/constrainer.rb', line 6 def initialize(a, b) @a = a @b = b @comparator = Boundy::Bound::Comparator.new(a,b) end |
Instance Method Details
#max ⇒ Object
12 13 14 15 16 17 18 |
# File 'lib/boundy/bound/constrainer.rb', line 12 def max if @comparator.compare == :left @a else @b end end |
#min ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/boundy/bound/constrainer.rb', line 20 def min if @comparator.compare == :right @a else @b end end |