Class: Reactor::Plans::DeleteAttributeGroup

Inherits:
CommonAttributeGroup show all
Defined in:
lib/reactor/plans/delete_attribute_group.rb

Constant Summary

Constants inherited from CommonAttributeGroup

CommonAttributeGroup::ALLOWED_PARAMS

Instance Method Summary collapse

Methods inherited from CommonAttributeGroup

#add_attributes, #remove_attributes, #set

Methods included from Prepared

#error, #separate_arguments

Constructor Details

#initialize(*args) ⇒ DeleteAttributeGroup

Returns a new instance of DeleteAttributeGroup.



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

def initialize(*args)
  super()
  (obj_class, name), options = separate_arguments(*args)
  @name = name || options[:name]
  @obj_class = obj_class || options[:obj_class]
  @pk = "#{@obj_class}.#{@name}"
end

Instance Method Details

#migrate!Object



21
22
23
24
# File 'lib/reactor/plans/delete_attribute_group.rb', line 21

def migrate!
  attrib = Reactor::Cm::AttributeGroup.get(@pk)
  attrib.delete!
end

#prepare!Object



15
16
17
18
19
# File 'lib/reactor/plans/delete_attribute_group.rb', line 15

def prepare!
  error("name ist nil") if @name.nil?
  error("obj_class is nil") if @obj_class.nil?
  error("attribute group #{@pk} does not exist") if not Reactor::Cm::AttributeGroup.exists?(@pk)
end