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.



6
7
8
9
10
11
12
13
14
# File 'lib/reactor/plans/create_group.rb', line 6

def initialize(*args)
   super()

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

   @name = name || options[:name]

   set(:name, @name)
end

Instance Method Details

#migrate!Object



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

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

#prepare!Object



16
17
18
19
20
21
# File 'lib/reactor/plans/create_group.rb', line 16

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

  prepare_params!(nil)
end