Sha256: e84e68316a7fccaf6a8e0bfb812a12040c11aaeb66f0a338398beb6abb9d7209

Contents?: true

Size: 1.14 KB

Versions: 6

Compression:

Stored size: 1.14 KB

Contents

class Birdspotting::Configuration
  attr_accessor :start_check_at_version,
                :check_bypass_env_var,
                :add_column_position_check,
                :encoding_check,
                :encoding_check_message,
                :rename_column_check,
                :rename_column_message,
                :remove_column_check

  def self.default
    new.tap do |config|
      config.start_check_at_version = nil
      config.check_bypass_env_var = "BYPASS_SCHEMA_STATEMENTS_CHECK"
      config.add_column_position_check = true
      config.encoding_check = true
      config.encoding_check_message = "\n/!\\ You are dealing with a %<type>s field" \
        "(%<column_name>s): did you think about emojis and used the appropriate encoding? /!\\ \n\n"
      config.rename_column_check = true
      config.rename_column_message = "Don't use rename_column! https://stackoverflow.com/a/18542147"
      config.remove_column_check = true
    end
  end

  %w[
    add_column_position_check
    encoding_check
    rename_column_check
    remove_column_check
  ].each do |name|
    define_method "#{name}?" do
      public_send(name)
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
birdspotting-0.1.8 lib/birdspotting/configuration.rb
birdspotting-0.1.6 lib/birdspotting/configuration.rb
birdspotting-0.1.5 lib/birdspotting/configuration.rb
birdspotting-0.1.4 lib/birdspotting/configuration.rb
birdspotting-0.1.3 lib/birdspotting/configuration.rb
birdspotting-0.1.2 lib/birdspotting/configuration.rb