Class: Gem::Source::Lock
- Inherits:
-
Gem::Source
- Object
- Gem::Source
- Gem::Source::Lock
- Defined in:
- lib/rubygems/source/lock.rb
Overview
A Lock source wraps an installed gem’s source and sorts before other sources during dependency resolution. This allows RubyGems to prefer gems from dependency lock files.
Constant Summary
Constants inherited from Gem::Source
Instance Attribute Summary collapse
-
#wrapped ⇒ Object
readonly
The wrapped Gem::Source.
Instance Method Summary collapse
-
#<=>(other) ⇒ Object
:nodoc:.
-
#==(other) ⇒ Object
:nodoc:.
-
#fetch_spec(name_tuple) ⇒ Object
Delegates to the wrapped source’s fetch_spec method.
-
#hash ⇒ Object
:nodoc:.
-
#initialize(source) ⇒ Lock
constructor
Creates a new Lock source that wraps
source
and moves it earlier in the sort list. -
#uri ⇒ Object
:nodoc:.
Methods inherited from Gem::Source
#cache_dir, #dependency_resolver_set, #download, #load_specs, #pretty_print, #typo_squatting?, #update_cache?
Methods included from Text
#clean_text, #format_text, #levenshtein_distance, #min3, #truncate_text
Constructor Details
#initialize(source) ⇒ Lock
Creates a new Lock source that wraps source
and moves it earlier in the sort list.
18 19 20 |
# File 'lib/rubygems/source/lock.rb', line 18 def initialize(source) @wrapped = source end |
Instance Attribute Details
#wrapped ⇒ Object (readonly)
The wrapped Gem::Source
12 13 14 |
# File 'lib/rubygems/source/lock.rb', line 12 def wrapped @wrapped end |
Instance Method Details
#<=>(other) ⇒ Object
:nodoc:
22 23 24 25 26 27 28 29 |
# File 'lib/rubygems/source/lock.rb', line 22 def <=>(other) # :nodoc: case other when Gem::Source::Lock then @wrapped <=> other.wrapped when Gem::Source then 1 end end |
#==(other) ⇒ Object
:nodoc:
31 32 33 |
# File 'lib/rubygems/source/lock.rb', line 31 def ==(other) # :nodoc: (self <=> other) == 0 end |
#fetch_spec(name_tuple) ⇒ Object
Delegates to the wrapped source’s fetch_spec method.
42 43 44 |
# File 'lib/rubygems/source/lock.rb', line 42 def fetch_spec(name_tuple) @wrapped.fetch_spec name_tuple end |
#hash ⇒ Object
:nodoc:
35 36 37 |
# File 'lib/rubygems/source/lock.rb', line 35 def hash # :nodoc: @wrapped.hash ^ 3 end |
#uri ⇒ Object
:nodoc:
46 47 48 |
# File 'lib/rubygems/source/lock.rb', line 46 def uri # :nodoc: @wrapped.uri end |