Class: Boundy::Domain::Constrainer

Inherits:
Object
  • Object
show all
Defined in:
lib/boundy/domain/constrainer.rb

Instance Method Summary collapse

Constructor Details

#initialize(me, other) ⇒ Constrainer

Returns a new instance of Constrainer.



7
8
9
10
# File 'lib/boundy/domain/constrainer.rb', line 7

def initialize(me, other)
  @me = me
  @other = other
end

Instance Method Details

#constrainObject



13
14
15
16
17
18
# File 'lib/boundy/domain/constrainer.rb', line 13

def constrain
  from = Boundy::Bound::Constrainer.new(@me.from, @other.from)
  to = Boundy::Bound::Constrainer.new(@me.to, @other.to)

  Boundy::Domain.new(from.max, to.min)
end