In Files

  • bundler/settings/validator.rb

Parent

Class/Module Index [+]

Quicksearch

Bundler::Settings::Validator::Rule

Attributes

description[R]

Public Class Methods

new(keys, description, &validate) click to toggle source
 
               # File bundler/settings/validator.rb, line 8
def initialize(keys, description, &validate)
  @keys = keys
  @description = description
  @validate = validate
end
            

Public Instance Methods

fail!(key, value, *reasons) click to toggle source
 
               # File bundler/settings/validator.rb, line 18
def fail!(key, value, *reasons)
  reasons.unshift @description
  raise InvalidOption, "Setting `#{key}` to #{value.inspect} failed:\n#{reasons.map {|r| " - #{r}" }.join("\n")}"
end
            
k(key) click to toggle source
 
               # File bundler/settings/validator.rb, line 35
def k(key)
  Bundler.settings.key_for(key)
end
            
set(settings, key, value, *reasons) click to toggle source
 
               # File bundler/settings/validator.rb, line 23
def set(settings, key, value, *reasons)
  hash_key = k(key)
  return if settings[hash_key] == value
  reasons.unshift @description
  Bundler.ui.info "Setting `#{key}` to #{value.inspect}, since #{reasons.join(", ")}"
  if value.nil?
    settings.delete(hash_key)
  else
    settings[hash_key] = value
  end
end
            
validate!(key, value, settings) click to toggle source
 
               # File bundler/settings/validator.rb, line 14
def validate!(key, value, settings)
  instance_exec(key, value, settings, &@validate)
end
            
There is an updated format of the API docs for this version here.