Class: Migrate::Migration

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = self.class.migration_name) ⇒ Migration

Returns a new instance of Migration.



27
28
29
# File 'lib/migrate/migration.rb', line 27

def initialize(name = self.class.migration_name)
	@name = name
end

Instance Attribute Details

#nameObject (readonly)

Returns the value of attribute name.



31
32
33
# File 'lib/migrate/migration.rb', line 31

def name
  @name
end

Class Method Details

.load_path(path) ⇒ Object



36
37
38
39
40
41
42
43
44
45
46
47
# File 'lib/migrate/migration.rb', line 36

def self.load_path(path)
	klass = Class.new(Migration)
	migration_name = File.basename(path)
	
	klass.define_singleton_method(:migration_name) do
		migration_name
	end
	
	klass.class_eval(File.read(path), path)
	
	klass.freeze
end

.migration_nameObject



23
24
25
# File 'lib/migrate/migration.rb', line 23

def self.migration_name
	self.name
end

Instance Method Details

#call(controller) ⇒ Object



33
34
# File 'lib/migrate/migration.rb', line 33

def call(controller)
end