Class: Merb::Generators::MigrationGenerator

Inherits:
ComponentGenerator show all
Defined in:
lib/merb-gen/migration.rb

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Generator

#initialize, #with_modules

Constructor Details

This class inherits a constructor from Merb::Generators::Generator

Class Method Details

.source_rootObject



5
6
7
# File 'lib/merb-gen/migration.rb', line 5

def self.source_root
  File.join(super, 'migration')
end

Instance Method Details

#class_nameObject



38
39
40
# File 'lib/merb-gen/migration.rb', line 38

def class_name
  self.name.camel_case
end

#file_nameObject



46
47
48
# File 'lib/merb-gen/migration.rb', line 46

def file_name
  "#{version}_#{migration_name}"
end

#migration_nameObject



42
43
44
# File 'lib/merb-gen/migration.rb', line 42

def migration_name
  self.name.snake_case
end

#table_nameObject



34
35
36
# File 'lib/merb-gen/migration.rb', line 34

def table_name
  self.name.snake_case.pluralize
end

#versionObject



50
51
52
53
# File 'lib/merb-gen/migration.rb', line 50

def version
  # TODO: handle ActiveRecord timestamped migrations
  format("%03d", current_migration_nr + 1)
end