Class: DBLeftovers::Constraint

Inherits:
Object
  • Object
show all
Defined in:
lib/db_leftovers/constraint.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(constraint_name, on_table, check) ⇒ Constraint

Returns a new instance of Constraint.



6
7
8
9
10
# File 'lib/db_leftovers/constraint.rb', line 6

def initialize(constraint_name, on_table, check)
  @constraint_name = constraint_name.to_s
  @on_table = on_table.to_s
  @check = check
end

Instance Attribute Details

#checkObject

Returns the value of attribute check.



4
5
6
# File 'lib/db_leftovers/constraint.rb', line 4

def check
  @check
end

#constraint_nameObject

Returns the value of attribute constraint_name.



4
5
6
# File 'lib/db_leftovers/constraint.rb', line 4

def constraint_name
  @constraint_name
end

#on_tableObject

Returns the value of attribute on_table.



4
5
6
# File 'lib/db_leftovers/constraint.rb', line 4

def on_table
  @on_table
end

Instance Method Details

#equals(other) ⇒ Object



12
13
14
15
16
# File 'lib/db_leftovers/constraint.rb', line 12

def equals(other)
  other.constraint_name == constraint_name and
  other.on_table == on_table and
  other.check == check
end

#to_sObject



18
19
20
# File 'lib/db_leftovers/constraint.rb', line 18

def to_s
  "<#{@constraint_name}: #{@on_table} CHECK (#{@check})>"
end