Class: Reactor::Plans::CreateGroup

Inherits:
CommonGroup show all
Defined in:
lib/reactor/plans/create_group.rb

Constant Summary

Constants inherited from CommonGroup

Reactor::Plans::CommonGroup::ALLOWED_PARAMS

Instance Method Summary collapse

Methods inherited from CommonGroup

#set

Methods included from Prepared

#error, #separate_arguments

Constructor Details

#initialize(*args) ⇒ CreateGroup

Returns a new instance of CreateGroup.



10
11
12
13
14
15
16
17
18
# File 'lib/reactor/plans/create_group.rb', line 10

def initialize(*args)
   super()

   (name, _), options = separate_arguments(*args)

   @name = name || options[:name]

   set(:name, @name)
end

Instance Method Details

#migrate!Object



27
28
29
# File 'lib/reactor/plans/create_group.rb', line 27

def migrate!
  Reactor::Cm::Group.create(@params)
end

#prepare!Object



20
21
22
23
24
25
# File 'lib/reactor/plans/create_group.rb', line 20

def prepare!
  error('name is nil') if @name.nil?
  error("group #{@name} already exists") if Reactor::Cm::Group.exists?(@name)

  prepare_params!(nil)
end