class Bundler::FeatureFlag

Public Class Methods

new(bundler_version) click to toggle source
# File bundler/feature_flag.rb, line 45
def initialize(bundler_version)
  @bundler_version = Gem::Version.create(bundler_version)
end

Private Class Methods

settings_flag(flag, &default) click to toggle source
# File bundler/feature_flag.rb, line 5
def self.settings_flag(flag, &default)
  unless Bundler::Settings::BOOL_KEYS.include?(flag.to_s)
    raise "Cannot use `#{flag}` as a settings feature flag since it isn't a bool key"
  end

  settings_method("#{flag}?", flag, &default)
end
settings_method(name, key, &default) click to toggle source
# File bundler/feature_flag.rb, line 19
def self.settings_method(name, key, &default)
  define_method(name) do
    value = Bundler.settings[key]
    value = instance_eval(&default) if value.nil?
    value
  end
end
settings_option(key, &default) click to toggle source
# File bundler/feature_flag.rb, line 14
def self.settings_option(key, &default)
  settings_method(key, key, &default)
end

Private Instance Methods

major_version() click to toggle source
# File bundler/feature_flag.rb, line 49
def major_version
  @bundler_version.segments.first
end