Exception: Gem::ImpossibleDependenciesError

Inherits:
Exception
  • Object
show all
Defined in:
lib/rubygems/exceptions.rb

Overview

Raised by Gem::Resolver when dependencies conflict and create the inability to find a valid possible spec for a request.

Instance Attribute Summary collapse

Attributes inherited from Exception

#source_exception

Instance Method Summary collapse

Methods included from Deprecate

deprecate, skip, skip=, skip_during

Constructor Details

#initialize(request, conflicts) ⇒ ImpossibleDependenciesError


140
141
142
143
144
145
# File 'lib/rubygems/exceptions.rb', line 140

def initialize request, conflicts
  @request   = request
  @conflicts = conflicts

  super build_message
end

Instance Attribute Details

#conflictsObject (readonly)

Returns the value of attribute conflicts


137
138
139
# File 'lib/rubygems/exceptions.rb', line 137

def conflicts
  @conflicts
end

#requestObject (readonly)

Returns the value of attribute request


138
139
140
# File 'lib/rubygems/exceptions.rb', line 138

def request
  @request
end

Instance Method Details

#build_messageObject

:nodoc:


147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/rubygems/exceptions.rb', line 147

def build_message # :nodoc:
  requester  = @request.requester
  requester  = requester ? requester.spec.full_name : 'The user'
  dependency = @request.dependency

  message = "#{requester} requires #{dependency} but it conflicted:\n".dup

  @conflicts.each do |_, conflict|
    message << conflict.explanation
  end

  message
end

#dependencyObject


161
162
163
# File 'lib/rubygems/exceptions.rb', line 161

def dependency
  @request.dependency
end