Sha256: bf6df4d0bc6f5de398ca076103306c66eded847721234ffd21144a0c44e37e8d

Contents?: true

Size: 756 Bytes

Versions: 8

Compression:

Stored size: 756 Bytes

Contents

require "reactor/plans/common_obj_class"

module Reactor
  module Plans
    class CreateObjClass < CommonObjClass
      def initialize(*args)
        super()
        (name, type), options = separate_arguments(*args)
        @name = name || options[:name]
        @type = type || options[:objType] || options[:type]
      end

      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

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

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
infopark_reactor-1.29.1 lib/reactor/plans/create_obj_class.rb
infopark_reactor-1.29.0 lib/reactor/plans/create_obj_class.rb
infopark_reactor-1.28.0 lib/reactor/plans/create_obj_class.rb
infopark_reactor-1.27.0.rc10 lib/reactor/plans/create_obj_class.rb
infopark_reactor-1.27.0.rc9 lib/reactor/plans/create_obj_class.rb
infopark_reactor-1.27.0.rc8 lib/reactor/plans/create_obj_class.rb
infopark_reactor-1.27.0.rc7 lib/reactor/plans/create_obj_class.rb
infopark_reactor-1.27.0.rc4 lib/reactor/plans/create_obj_class.rb