Class: Gem::Resolver::DependencyRequest
- Inherits:
-
Object
- Object
- Gem::Resolver::DependencyRequest
- Defined in:
- lib/rubygems/resolver/dependency_request.rb
Overview
Used Internally. Wraps a Dependency object to also track which spec contained the Dependency.
Instance Attribute Summary collapse
-
#dependency ⇒ Object
readonly
The wrapped Gem::Dependency.
-
#requester ⇒ Object
readonly
The request for this dependency.
Instance Method Summary collapse
-
#==(other) ⇒ Object
:nodoc:.
-
#explicit? ⇒ Boolean
Indicate that the request is for a gem explicitly requested by the user.
-
#implicit? ⇒ Boolean
Indicate that the request is for a gem requested as a dependency of another gem.
-
#initialize(dependency, requester) ⇒ DependencyRequest
constructor
Creates a new DependencyRequest for
dependency
fromrequester
. -
#matches_spec?(spec) ⇒ Boolean
Does this dependency request match
spec
. -
#name ⇒ Object
The name of the gem this dependency request is requesting.
-
#pretty_print(q) ⇒ Object
:nodoc:.
-
#request_context ⇒ Object
Return a String indicating who caused this request to be added (only valid for implicit requests).
-
#requirement ⇒ Object
The version requirement for this dependency request.
-
#to_s ⇒ Object
:nodoc:.
Constructor Details
#initialize(dependency, requester) ⇒ DependencyRequest
Creates a new DependencyRequest for dependency
from requester
. +requester may be nil if the request came from a user.
21 22 23 24 |
# File 'lib/rubygems/resolver/dependency_request.rb', line 21 def initialize dependency, requester @dependency = dependency @requester = requester end |
Instance Attribute Details
#dependency ⇒ Object (readonly)
The wrapped Gem::Dependency
10 11 12 |
# File 'lib/rubygems/resolver/dependency_request.rb', line 10 def dependency @dependency end |
#requester ⇒ Object (readonly)
The request for this dependency.
15 16 17 |
# File 'lib/rubygems/resolver/dependency_request.rb', line 15 def requester @requester end |
Instance Method Details
#==(other) ⇒ Object
:nodoc:
26 27 28 29 30 31 32 33 34 35 |
# File 'lib/rubygems/resolver/dependency_request.rb', line 26 def == other # :nodoc: case other when Gem::Dependency @dependency == other when Gem::Resolver::DependencyRequest @dependency == other.dependency && @requester == other.requester else false end end |
#explicit? ⇒ Boolean
Indicate that the request is for a gem explicitly requested by the user
54 55 56 |
# File 'lib/rubygems/resolver/dependency_request.rb', line 54 def explicit? @requester.nil? end |
#implicit? ⇒ Boolean
Indicate that the request is for a gem requested as a dependency of another gem
62 63 64 |
# File 'lib/rubygems/resolver/dependency_request.rb', line 62 def implicit? !explicit? end |
#matches_spec?(spec) ⇒ Boolean
Does this dependency request match spec
40 41 42 |
# File 'lib/rubygems/resolver/dependency_request.rb', line 40 def matches_spec?(spec) @dependency.matches_spec? spec end |
#name ⇒ Object
The name of the gem this dependency request is requesting.
47 48 49 |
# File 'lib/rubygems/resolver/dependency_request.rb', line 47 def name @dependency.name end |
#pretty_print(q) ⇒ Object
:nodoc:
74 75 76 77 78 79 80 81 82 83 |
# File 'lib/rubygems/resolver/dependency_request.rb', line 74 def pretty_print q # :nodoc: q.group 2, '[Dependency request ', ']' do q.breakable q.text @dependency.to_s q.breakable q.text ' requested by ' q.pp @requester end end |
#request_context ⇒ Object
Return a String indicating who caused this request to be added (only valid for implicit requests)
70 71 72 |
# File 'lib/rubygems/resolver/dependency_request.rb', line 70 def request_context @requester ? @requester.request : "(unknown)" end |
#requirement ⇒ Object
The version requirement for this dependency request
88 89 90 |
# File 'lib/rubygems/resolver/dependency_request.rb', line 88 def requirement @dependency.requirement end |
#to_s ⇒ Object
:nodoc:
92 93 94 |
# File 'lib/rubygems/resolver/dependency_request.rb', line 92 def to_s # :nodoc: @dependency.to_s end |