Class: Reactor::Plans::CreateObjClass

Inherits:
CommonObjClass show all
Defined in:
lib/reactor/plans/create_obj_class.rb

Constant Summary

Constants inherited from CommonObjClass

Reactor::Plans::CommonObjClass::ALLOWED_PARAMS

Instance Method Summary collapse

Methods inherited from CommonObjClass

#drop, #set, #take

Methods included from Prepared

#error, #separate_arguments

Constructor Details

#initialize(*args) ⇒ CreateObjClass

Returns a new instance of CreateObjClass.



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

def initialize(*args)
  super()
  (name, type), options = separate_arguments(*args)
  @name = name || options[:name]
  @type = type || options[:objType] || options[:type]
end

Instance Method Details

#migrate!Object



22
23
24
25
26
# File 'lib/reactor/plans/create_obj_class.rb', line 22

def migrate!
  klass = Reactor::Cm::ObjClass.create(@name, @type)
  migrate_attrs!(klass)
  migrate_params!(klass)
end

#prepare!Object



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

def prepare!
  error("name is nil") if @name.nil?
  error("type is nil") if @type.nil?
  error("objClass #{@name} already exists") if Reactor::Cm::ObjClass.exists?(@name)
  prepare_attrs!(nil)
  prepare_params!(nil)
end