GitHub Access Token became invalid

It seems like the GitHub access token used for retrieving details about this repository from GitHub became invalid. This might prevent certain types of inspections from being run (in particular, everything related to pull requests).
Please ask an admin of your repository to re-new the access token on this website.
Completed
Push — master ( 24adef...7b60c7 )
by Leonardo
01:22
created

InstallGenerator.create_migration_file()   A

Complexity

Conditions 2

Size

Total Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
cc 2
dl 0
loc 3
rs 10
c 0
b 0
f 0
1
# frozen_string_literal: true
2
3
require "rails/generators"
4
require "rails/generators/active_record"
5
6
module IbanBic
7
  # Installs Iban+Bic in a rails app.
8
  class InstallGenerator < ::Rails::Generators::Base
9
    include ::Rails::Generators::Migration
10
11
    source_root File.expand_path("../templates", __FILE__)
12
13
    class_option(
14
      :with_static_bics,
15
      type: :boolean,
16
      default: false,
17
      desc: "Don't create bics table, use static bics."
18
    )
19
20
    class_option(
21
      :bics_table_name,
22
      type: :string,
23
      default: "bics",
24
      desc: "BICs table name, `bics` by default."
25
    )
26
27
    desc "Generates an initializer file for configuring IbanBic." \
28
         " Also can generate a migration to add a bics table."
29
30
    def create_migration_file
31
      migration_template "create_bics.rb.erb", File.join("db", "migrate", "create_bics.rb") unless options.with_static_bics?
32
    end
33
34
    def create_initializer
35
      template "iban_bic.rb.erb", File.join("config", "initializers", "iban_bic.rb")
36
    end
37
38
    def self.next_migration_number(dirname)
39
      ::ActiveRecord::Generators::Base.next_migration_number(dirname)
40
    end
41
42
    def migration_version
43
      "[#{ActiveRecord::VERSION::MAJOR}.#{ActiveRecord::VERSION::MINOR}]"
44
    end
45
46
    def bics_table_name
47
      options.bics_table_name
48
    end
49
50
    def static_bics?
51
      options.with_static_bics?
52
    end
53
  end
54
end
55