Class: Bowline::Generators::MigrationGenerator
Instance Method Summary
collapse
Methods inherited from Generator
source_root, #with_modules
Instance Method Details
#class_name ⇒ Object
16
17
18
|
# File 'lib/bowline/generators/migration.rb', line 16
def class_name
"#{self.name.camel_case}Migration"
end
|
#file_name ⇒ Object
24
25
26
|
# File 'lib/bowline/generators/migration.rb', line 24
def file_name
"#{version}_#{migration_name}_migration"
end
|
#migration_name ⇒ Object
20
21
22
|
# File 'lib/bowline/generators/migration.rb', line 20
def migration_name
self.name.snake_case
end
|
#table_name ⇒ Object
12
13
14
|
# File 'lib/bowline/generators/migration.rb', line 12
def table_name
self.name.snake_case.pluralize
end
|
28
29
30
31
32
|
# File 'lib/bowline/generators/migration.rb', line 28
def version
n = options[:delete] ? current_migration_nr : current_migration_nr + 1
format("%03d", n)
end
|