Class: DbDiff::View

Inherits:
Object
  • Object
show all
Defined in:
lib/dbdiff/view.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#definitionObject (readonly)

Returns the value of attribute definition.



3
4
5
# File 'lib/dbdiff/view.rb', line 3

def definition
  @definition
end

#nameObject (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_deltaObject



20
21
22
# File 'lib/dbdiff/view.rb', line 20

def add_delta
  Delta::AddView.new(self)
end

#deep_cloneObject



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_deltaObject



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