123456789_123456789_123456789_123456789_123456789_

Class: Bundler::FeatureFlag

Relationships & Source Files
Inherits: Object
Defined in: lib/bundler/feature_flag.rb

Class Method Summary

Instance Method Summary

Constructor Details

.new(bundler_version) ⇒ FeatureFlag

[ GitHub ]

  
# File 'lib/bundler/feature_flag.rb', line 54

def initialize(bundler_version)
  @bundler_version = Gem::Version.create(bundler_version)
end

Class Method Details

.settings_flag(flag, &default) (private)

[ GitHub ]

  
# File 'lib/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) (private)

[ GitHub ]

  
# File 'lib/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) (private)

[ GitHub ]

  
# File 'lib/bundler/feature_flag.rb', line 14

def self.settings_option(key, &default)
  settings_method(key, key, &default)
end

Instance Method Details

#major_version (private)

[ GitHub ]

  
# File 'lib/bundler/feature_flag.rb', line 58

def major_version
  @bundler_version.segments.first
end