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.



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

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

Instance Method Details

#migrate!Object



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

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

#prepare!Object



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

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