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

Instance Method Summary collapse

Constructor Details

#initialize(request, conflicts) ⇒ ImpossibleDependenciesError

Returns a new instance of ImpossibleDependenciesError.


119
120
121
122
123
124
# File 'lib/rubygems/exceptions.rb', line 119

def initialize(request, conflicts)
  @request   = request
  @conflicts = conflicts

  super build_message
end

Instance Attribute Details

#conflictsObject (readonly)

Returns the value of attribute conflicts


116
117
118
# File 'lib/rubygems/exceptions.rb', line 116

def conflicts
  @conflicts
end

#requestObject (readonly)

Returns the value of attribute request


117
118
119
# File 'lib/rubygems/exceptions.rb', line 117

def request
  @request
end

Instance Method Details

#build_messageObject

:nodoc:


126
127
128
129
130
131
132
133
134
135
136
137
138
# File 'lib/rubygems/exceptions.rb', line 126

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


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

def dependency
  @request.dependency
end