Class: DbDiff::View
- Inherits:
-
Object
- Object
- DbDiff::View
- Defined in:
- lib/dbdiff/view.rb
Instance Attribute Summary collapse
-
#definition ⇒ Object
readonly
Returns the value of attribute definition.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #add_delta ⇒ Object
- #deep_clone ⇒ Object
- #drop_delta ⇒ Object
-
#initialize(info = {}) ⇒ View
constructor
A new instance of View.
- #modify_delta(new_element) ⇒ Object
Constructor Details
#initialize(info = {}) ⇒ View
Returns a new instance of View.
5 6 7 8 |
# File 'lib/dbdiff/view.rb', line 5 def initialize(info = {}) @definition = info['VIEW_DEFINITION'] @name = info['TABLE_NAME'] end |
Instance Attribute Details
#definition ⇒ Object (readonly)
Returns the value of attribute definition.
3 4 5 |
# File 'lib/dbdiff/view.rb', line 3 def definition @definition end |
#name ⇒ Object (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'lib/dbdiff/view.rb', line 3 def name @name end |
Instance Method Details
#==(other) ⇒ Object
11 12 13 |
# File 'lib/dbdiff/view.rb', line 11 def ==(other) self.definition == other.definition end |
#add_delta ⇒ Object
20 21 22 |
# File 'lib/dbdiff/view.rb', line 20 def add_delta Delta::AddView.new(self) end |
#deep_clone ⇒ Object
15 16 17 18 |
# File 'lib/dbdiff/view.rb', line 15 def deep_clone t = Marshal::load(Marshal.dump(self)) # must clear rows out since they won't necessary be in the copy end |
#drop_delta ⇒ Object
28 29 30 |
# File 'lib/dbdiff/view.rb', line 28 def drop_delta Delta::DropView.new(self) end |
#modify_delta(new_element) ⇒ Object
24 25 26 |
# File 'lib/dbdiff/view.rb', line 24 def modify_delta(new_element) [self.drop_delta, new_element.add_delta] end |