Class: Reactor::Plans::RenameObjClass

Inherits:
Object
  • Object
show all
Includes:
Prepared
Defined in:
lib/reactor/plans/rename_obj_class.rb

Instance Method Summary collapse

Methods included from Prepared

#error, #separate_arguments

Constructor Details

#initialize(*args) ⇒ RenameObjClass

Returns a new instance of RenameObjClass.



7
8
9
10
11
# File 'lib/reactor/plans/rename_obj_class.rb', line 7

def initialize(*args)
  (from, to), options = separate_arguments(*args)
  @from = from || options[:from]
  @to = to || options[:to]
end

Instance Method Details

#migrate!Object



20
21
22
# File 'lib/reactor/plans/rename_obj_class.rb', line 20

def migrate!
  Reactor::Cm::ObjClass.rename(@from, @to)
end

#prepare!Object



13
14
15
16
17
18
# File 'lib/reactor/plans/rename_obj_class.rb', line 13

def prepare!
  error("from is nil") if @from.nil?
  error("to is nil") if @to.nil?
  error("from does not exist") if not Reactor::Cm::ObjClass.exists?(@from)
  error("to does exist") if Reactor::Cm::ObjClass.exists?(@to)
end