Class: Mongration::CreateMigration
- Inherits:
-
Object
- Object
- Mongration::CreateMigration
- Defined in:
- lib/mongration/create_migration.rb,
lib/mongration/create_migration/migration_file_writer.rb
Defined Under Namespace
Classes: MigrationFileWriter
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(name, options) ⇒ CreateMigration
constructor
A new instance of CreateMigration.
- #perform ⇒ Object
Constructor Details
#initialize(name, options) ⇒ CreateMigration
Returns a new instance of CreateMigration.
12 13 14 15 16 17 |
# File 'lib/mongration/create_migration.rb', line 12 def initialize(name, ) @options = snakecase = name.gsub(/([a-z])([A-Z0-9])/, '\1_\2').downcase @file_name = "#{next_migration_number}_#{snakecase}.rb" end |
Class Method Details
.perform(name, options = {}) ⇒ Object
8 9 10 |
# File 'lib/mongration/create_migration.rb', line 8 def self.perform(name, = {}) new(name, ).perform end |
Instance Method Details
#perform ⇒ Object
19 20 21 22 23 24 |
# File 'lib/mongration/create_migration.rb', line 19 def perform MigrationFileWriter.write( @file_name, @options ) end |