Class: Reactor::Plans::RenameGroup
- Inherits:
-
Object
- Object
- Reactor::Plans::RenameGroup
show all
- Includes:
- Prepared
- Defined in:
- lib/reactor/plans/rename_group.rb
Instance Method Summary
collapse
Methods included from Prepared
#error, #separate_arguments
Constructor Details
Returns a new instance of RenameGroup.
10
11
12
13
14
15
|
# File 'lib/reactor/plans/rename_group.rb', line 10
def initialize(*args)
(from, to), options = separate_arguments(*args)
@from = from || options[:from]
@to = to || options[:to]
end
|
Instance Method Details
#migrate! ⇒ Object
24
25
26
27
|
# File 'lib/reactor/plans/rename_group.rb', line 24
def migrate!
group = Reactor::Cm::Group.get(@from)
group.rename!(@to)
end
|
#prepare! ⇒ Object
17
18
19
20
21
22
|
# File 'lib/reactor/plans/rename_group.rb', line 17
def prepare!
error('from is nil') if @from.nil?
error('to is nil') if @to.nil?
error('from does not exist') unless Reactor::Cm::Group.exists?(@from)
error('to does exist') if Reactor::Cm::Group.exists?(@to)
end
|