Class: DbDiff::Row
- Inherits:
-
TableElement
- Object
- TableElement
- DbDiff::Row
- Defined in:
- lib/dbdiff/row.rb
Instance Attribute Summary collapse
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#primary_key ⇒ Object
readonly
Returns the value of attribute primary_key.
Attributes inherited from TableElement
Instance Method Summary collapse
- #==(other) ⇒ Object
- #add_delta ⇒ Object
- #drop_delta ⇒ Object
-
#initialize(table, info = {}) ⇒ Row
constructor
A new instance of Row.
- #modify_delta(new_element) ⇒ Object
Methods inherited from TableElement
Constructor Details
#initialize(table, info = {}) ⇒ Row
Returns a new instance of Row.
8 9 10 11 12 13 |
# File 'lib/dbdiff/row.rb', line 8 def initialize(table, info = {}) @data = info.dup @primary_key = table.primary_key @name = @primary_key.map {|k|@data[k] }.join("|") # XXX fix this to be more unique of a name @table_name = table.name end |
Instance Attribute Details
#data ⇒ Object (readonly)
Returns the value of attribute data.
6 7 8 |
# File 'lib/dbdiff/row.rb', line 6 def data @data end |
#primary_key ⇒ Object (readonly)
Returns the value of attribute primary_key.
6 7 8 |
# File 'lib/dbdiff/row.rb', line 6 def primary_key @primary_key end |
Instance Method Details
#==(other) ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/dbdiff/row.rb', line 28 def ==(other) other_data = other.data.dup source_data = self.data.dup %w(created_on updated_on).each do|c| other_data.delete(c) source_data.delete(c) end source_data == other_data end |
#add_delta ⇒ Object
16 17 18 |
# File 'lib/dbdiff/row.rb', line 16 def add_delta Delta::AddRow.new(self) end |