Class: Migrate::Migration
- Inherits:
-
Object
- Object
- Migrate::Migration
- Defined in:
- lib/migrate/migration.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
readonly
Returns the value of attribute name.
Instance Method Summary collapse
- #<=>(other) ⇒ Object
- #call(controller) ⇒ Object
-
#initialize(path) ⇒ Migration
constructor
A new instance of Migration.
- #migrate(target, using:, &block) ⇒ Object
- #to_s ⇒ Object
Constructor Details
#initialize(path) ⇒ Migration
Returns a new instance of Migration.
23 24 25 26 |
# File 'lib/migrate/migration.rb', line 23 def initialize(path) @path = path @name = path.relative_path end |
Instance Attribute Details
#name ⇒ Object (readonly)
Returns the value of attribute name.
28 29 30 |
# File 'lib/migrate/migration.rb', line 28 def name @name end |
Instance Method Details
#<=>(other) ⇒ Object
42 43 44 |
# File 'lib/migrate/migration.rb', line 42 def <=> other @name <=> other.name end |
#call(controller) ⇒ Object
30 31 32 |
# File 'lib/migrate/migration.rb', line 30 def call(controller) self.instance_eval(::File.read(@path), @path) end |
#migrate(target, using:, &block) ⇒ Object
34 35 36 |
# File 'lib/migrate/migration.rb', line 34 def migrate(target, using:, &block) using.migrate(self.name, target, &block) end |
#to_s ⇒ Object
38 39 40 |
# File 'lib/migrate/migration.rb', line 38 def to_s @name end |