aboutsummaryrefslogtreecommitdiffstats
path: root/lib/sql_algebra/relations/join_operation.rb
blob: 2b4548a041af35bbb1b124591d4ff4cb92c31913 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
class JoinOperation
  attr_reader :relation1, :relation2
  
  def initialize(relation1, relation2)
    @relation1, @relation2 = relation1, relation2
  end
  
  def on(*predicates)
    relation_class.new(relation1, relation2, *predicates)
  end
  
  def ==(other)
    (relation1 == other.relation1 and relation2 == other.relation2) or
      (relation1 == other.relation2 and relation2 == other.relation1)
  end
end