Class: Perpetuity::Postgres::NegatedQuery

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ NegatedQuery

Returns a new instance of NegatedQuery.



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

def initialize &block
  @query = Query.new(&block)
end

Instance Attribute Details

#queryObject (readonly)

Returns the value of attribute query.



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

def query
  @query
end

Instance Method Details

#to_dbObject



12
13
14
# File 'lib/perpetuity/postgres/negated_query.rb', line 12

def to_db
  "NOT (#{query.to_db})"
end

#to_sObject



16
17
18
# File 'lib/perpetuity/postgres/negated_query.rb', line 16

def to_s
  to_db
end