Class: MaglevRecord::ReversedSuperclassMismatchChange

Inherits:
SuperclassMismatchChangeBase show all
Defined in:
lib/maglev_record/snapshot/superclass_mismatch_change.rb

Instance Method Summary collapse

Methods inherited from SuperclassMismatchChangeBase

#changes_since, #nothing_changed?, #superclass_mismatch_class_names, #superclass_mismatch_classes

Constructor Details

#initialize(superclass_mismatch_change) ⇒ ReversedSuperclassMismatchChange

TODO: test



106
107
108
# File 'lib/maglev_record/snapshot/superclass_mismatch_change.rb', line 106

def initialize(superclass_mismatch_change)
  @superclass_mismatch_change = superclass_mismatch_change
end

Instance Method Details

#class_nameObject



122
123
124
# File 'lib/maglev_record/snapshot/superclass_mismatch_change.rb', line 122

def class_name
  superclass_mismatch_change.mismatching_class
end

#file_pathObject



126
127
128
# File 'lib/maglev_record/snapshot/superclass_mismatch_change.rb', line 126

def file_path
  superclass_mismatch_change.file_path
end

#migration_string(identation = 0) ⇒ Object



134
135
136
137
138
139
140
# File 'lib/maglev_record/snapshot/superclass_mismatch_change.rb', line 134

def migration_string(identation = 0)
  " " * identation + [
    "# TypeError: superclass mismatch for #{class_name}",
    "# in #{file_path}",
    "#{class_name}.change_superclass_to #{old_superclass.name}"
  ].join("\n" + " " * identation)
end

#mismatching_classObject



118
119
120
# File 'lib/maglev_record/snapshot/superclass_mismatch_change.rb', line 118

def mismatching_class
  superclass_mismatch_change.mismatching_class
end

#old_superclassObject



130
131
132
# File 'lib/maglev_record/snapshot/superclass_mismatch_change.rb', line 130

def old_superclass
  mismatching_class.superclass
end

#reversedObject



114
115
116
# File 'lib/maglev_record/snapshot/superclass_mismatch_change.rb', line 114

def reversed
  superclass_mismatch_change
end

#superclass_mismatch_changeObject



110
111
112
# File 'lib/maglev_record/snapshot/superclass_mismatch_change.rb', line 110

def superclass_mismatch_change
  @superclass_mismatch_change
end