Class: Reactor::Migration

Inherits:
Object
  • Object
show all
Defined in:
lib/reactor/migration.rb

Constant Summary collapse

METHODS =
{
  :create_obj => Plans::CreateObj,
  :delete_obj => Plans::DeleteObj,
  :update_obj => Plans::UpdateObj,
  :create_class => Plans::CreateObjClass,
  :delete_class => Plans::DeleteObjClass,
  :update_class => Plans::UpdateObjClass,
  :rename_class => Plans::RenameObjClass,
  :create_attribute => Plans::CreateAttribute,
  :delete_attribute => Plans::DeleteAttribute,
  :update_attribute => Plans::UpdateAttribute,
  :create_group => Plans::CreateGroup,
  :delete_group => Plans::DeleteGroup,
  :update_group => Plans::UpdateGroup,
  :rename_group => Plans::RenameGroup,
  :create_channel => Plans::CreateChannel,
  :delete_channel => Plans::DeleteChannel
}

Class Method Summary collapse

Class Method Details

.containedObject



63
64
65
# File 'lib/reactor/migration.rb', line 63

def self.contained
  @contained || []
end

.contains(*args) ⇒ Object



55
56
57
58
59
60
61
# File 'lib/reactor/migration.rb', line 55

def self.contains(*args)
  @contained ||= []
  args.flatten.each do |arg|
    migration_num = arg.to_i.to_s
    @contained << migration_num
  end
end

.method_missing(name, *args, &block) ⇒ Object



40
41
42
43
44
45
46
47
48
49
# File 'lib/reactor/migration.rb', line 40

def self.method_missing(name, *args, &block)
  if METHODS.key? name.to_sym then
    instance = init(name,*args)
    plan(instance,&block)
    prepare(instance)
    migrate(instance)
  else
    super(name, *args, &block)
  end
end

.respond_to?(name) ⇒ Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/reactor/migration.rb', line 51

def self.respond_to?(name)
  METHODS.key?(name.to_sym) || super(name)
end