Class: IbanBic::InstallGenerator

Inherits:
Rails::Generators::Base
  • Object
show all
Includes:
Rails::Generators::Migration
Defined in:
lib/generators/iban_bic/install_generator.rb

Overview

Installs Iban+Bic in a rails app.

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.next_migration_number(dirname) ⇒ Object



38
39
40
# File 'lib/generators/iban_bic/install_generator.rb', line 38

def self.next_migration_number(dirname)
  ::ActiveRecord::Generators::Base.next_migration_number(dirname)
end

Instance Method Details

#bics_table_nameObject



46
47
48
# File 'lib/generators/iban_bic/install_generator.rb', line 46

def bics_table_name
  options.bics_table_name
end

#create_initializerObject



34
35
36
# File 'lib/generators/iban_bic/install_generator.rb', line 34

def create_initializer
  template "iban_bic.rb.erb", File.join("config", "initializers", "iban_bic.rb")
end

#create_migration_fileObject



30
31
32
# File 'lib/generators/iban_bic/install_generator.rb', line 30

def create_migration_file
  migration_template "create_bics.rb.erb", File.join("db", "migrate", "create_bics.rb") unless options.with_static_bics?
end

#migration_versionObject



42
43
44
# File 'lib/generators/iban_bic/install_generator.rb', line 42

def migration_version
  "[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]"
end

#static_bics?Boolean

Returns:

  • (Boolean)


50
51
52
# File 'lib/generators/iban_bic/install_generator.rb', line 50

def static_bics?
  options.with_static_bics?
end