class MinceMigrator::Migration
Attributes
name[R]
path[R]
relative_path[R]
status[R]
time_created[R]
Public Class Methods
find(name)
click to toggle source
# File lib/mince_migrator/migration.rb, line 45 def self.find(name) if file = Migrations::File.find(name) new_from_file file end end
load_from_file(path_to_file)
click to toggle source
# File lib/mince_migrator/migration.rb, line 51 def self.load_from_file(path_to_file) new_from_file Migrations::File.load_from_file(path_to_file) end
new(options)
click to toggle source
# File lib/mince_migrator/migration.rb, line 9 def initialize(options) @klass = options[:klass] @time_created = @klass.time_created self.name = options[:name] @relative_path = options[:relative_path] @path = options[:path] end
new_from_file(file)
click to toggle source
# File lib/mince_migrator/migration.rb, line 55 def self.new_from_file(file) new( klass: file.klass, name: file.name, relative_path: file.full_relative_path, path: file.full_path ) end
Public Instance Methods
age()
click to toggle source
# File lib/mince_migrator/migration.rb, line 17 def age @age ||= "#{(Time.now.utc.to_date - time_created.to_date).to_i}d" end
name=(val)
click to toggle source
# File lib/mince_migrator/migration.rb, line 21 def name=(val) @name ||= Migrations::Name.new(val).value end
ran?()
click to toggle source
# File lib/mince_migrator/migration.rb, line 33 def ran? !!ran_migration end
ran_migration()
click to toggle source
# File lib/mince_migrator/migration.rb, line 41 def ran_migration @ran_migration ||= RanMigration.find_by_name(name) end
revert()
click to toggle source
# File lib/mince_migrator/migration.rb, line 29 def revert @klass.revert end
run()
click to toggle source
# File lib/mince_migrator/migration.rb, line 25 def run @klass.run end