Class: Dbsketch::Comparison::Diff
- Inherits:
-
Object
- Object
- Dbsketch::Comparison::Diff
- Defined in:
- lib/dbsketch/comparison/diff.rb
Direct Known Subclasses
CheckConstraintDiff, ColumnDiff, ComputedColumnDiff, DatabaseDiff, ForeignKeyDiff, FunctionDiff, IndexDiff, PrimaryKeyDiff, ProcedureDiff, TableDiff, TriggerDiff, TypeDiff, UniqueConstraintDiff, ViewDiff
Instance Attribute Summary collapse
-
#new_value ⇒ Object
readonly
Returns the value of attribute new_value.
-
#old_value ⇒ Object
readonly
Returns the value of attribute old_value.
Instance Method Summary collapse
-
#addition? ⇒ Boolean
Returns true if the diff represents the addition of a new value.
-
#change? ⇒ Boolean
Returns true if the diff represents a change.
-
#deletion? ⇒ Boolean
Returns true if the diff represents the deletion of an old value.
-
#initialize(old_value, new_value) ⇒ Diff
constructor
A new instance of Diff.
Constructor Details
#initialize(old_value, new_value) ⇒ Diff
Returns a new instance of Diff.
9 10 11 12 13 14 15 |
# File 'lib/dbsketch/comparison/diff.rb', line 9 def initialize old_value, new_value ### Preconditions raise ArgumentError, "new_value is not different from old_value" unless new_value != old_value ### @old_value = old_value @new_value = new_value end |
Instance Attribute Details
#new_value ⇒ Object (readonly)
Returns the value of attribute new_value.
17 18 19 |
# File 'lib/dbsketch/comparison/diff.rb', line 17 def new_value @new_value end |
#old_value ⇒ Object (readonly)
Returns the value of attribute old_value.
17 18 19 |
# File 'lib/dbsketch/comparison/diff.rb', line 17 def old_value @old_value end |
Instance Method Details
#addition? ⇒ Boolean
Returns true if the diff represents the addition of a new value
30 31 32 |
# File 'lib/dbsketch/comparison/diff.rb', line 30 def addition? nil == @old_value and nil != @new_value end |
#change? ⇒ Boolean
Returns true if the diff represents a change
25 26 27 |
# File 'lib/dbsketch/comparison/diff.rb', line 25 def change? nil != @old_value and nil != @new_value end |
#deletion? ⇒ Boolean
Returns true if the diff represents the deletion of an old value
20 21 22 |
# File 'lib/dbsketch/comparison/diff.rb', line 20 def deletion? nil != @old_value and nil == @new_value end |