Class: Hippo::Command::GenerateMigration

Inherits:
NamedCommand
  • Object
show all
Includes:
MigrationSupport
Defined in:
lib/hippo/command/generate_migration.rb

Instance Attribute Summary collapse

Attributes inherited from NamedCommand

#class_name, #client_dir, #identifier, #namespace, #spec_dir

Instance Method Summary collapse

Methods included from MigrationSupport

#create_migration

Methods inherited from NamedCommand

#load_namespace, source_root

Instance Attribute Details

#file_nameObject (readonly)

Returns the value of attribute file_name.



18
19
20
# File 'lib/hippo/command/generate_migration.rb', line 18

def file_name
  @file_name
end

#table_nameObject (readonly)

Returns the value of attribute table_name.



18
19
20
# File 'lib/hippo/command/generate_migration.rb', line 18

def table_name
  @table_name
end

Instance Method Details

#generate_moduleObject



27
28
29
# File 'lib/hippo/command/generate_migration.rb', line 27

def generate_module
    create_migration
end

#set_variablesObject



20
21
22
23
24
25
# File 'lib/hippo/command/generate_migration.rb', line 20

def set_variables
    super
    @file_name  = name.underscore
    prefix = extension.db_table_prefix
    @table_name = prefix ? "#{prefix}_#{name.tableize}" : name.tableize
end