Class: Perpetuity::Postgres::QueryUnion

Inherits:
Object
  • Object
show all
Defined in:
lib/perpetuity/postgres/query_union.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(lhs, rhs) ⇒ QueryUnion

Returns a new instance of QueryUnion.



8
9
10
11
# File 'lib/perpetuity/postgres/query_union.rb', line 8

def initialize lhs, rhs
  @lhs = lhs
  @rhs = rhs
end

Instance Attribute Details

#lhsObject (readonly)

Returns the value of attribute lhs.



6
7
8
# File 'lib/perpetuity/postgres/query_union.rb', line 6

def lhs
  @lhs
end

#rhsObject (readonly)

Returns the value of attribute rhs.



6
7
8
# File 'lib/perpetuity/postgres/query_union.rb', line 6

def rhs
  @rhs
end

Instance Method Details

#&(other) ⇒ Object



21
22
23
# File 'lib/perpetuity/postgres/query_union.rb', line 21

def & other
  QueryIntersection.new(self, other)
end

#to_dbObject



13
14
15
# File 'lib/perpetuity/postgres/query_union.rb', line 13

def to_db
  "(#{lhs.to_db} OR #{rhs.to_db})"
end

#|(other) ⇒ Object



17
18
19
# File 'lib/perpetuity/postgres/query_union.rb', line 17

def | other
  QueryUnion.new(self, other)
end