Class: Dbsketch::Comparison::PrimaryKeyDiff

Inherits:
Diff
  • Object
show all
Defined in:
lib/dbsketch/comparison/primary_key_comparator.rb

Instance Attribute Summary collapse

Attributes inherited from Diff

#new_value, #old_value

Instance Method Summary collapse

Methods inherited from Diff

#addition?, #change?, #deletion?

Constructor Details

#initialize(old_key, new_key, columns) ⇒ PrimaryKeyDiff

Returns a new instance of PrimaryKeyDiff.



12
13
14
15
16
17
18
19
20
21
# File 'lib/dbsketch/comparison/primary_key_comparator.rb', line 12

def initialize old_key, new_key, columns
  super old_key, new_key
  ### Preconditions

  columns.each_with_index { |column, index| raise ArgumentError, "columns[#{index}] is not a Dbsketch::Comparison::Diff" unless column.is_a? Dbsketch::Comparison::Diff }
  ###

  if change?
    @name = Diff.new(old_key.name, new_key.name) if old_key.name != new_key.name
  end
  @columns = columns
end

Instance Attribute Details

#columnsObject (readonly)

Returns the value of attribute columns.



23
24
25
# File 'lib/dbsketch/comparison/primary_key_comparator.rb', line 23

def columns
  @columns
end

#nameObject (readonly)

Returns the value of attribute name.



23
24
25
# File 'lib/dbsketch/comparison/primary_key_comparator.rb', line 23

def name
  @name
end