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.
17 18 19 |
# File 'lib/rubygems/source/lock.rb', line 17 def initialize(source) @wrapped = source end |
Instance Attribute Details
#wrapped ⇒ Object (readonly)
The wrapped Gem::Source
11 12 13 |
# File 'lib/rubygems/source/lock.rb', line 11 def wrapped @wrapped end |
Instance Method Details
#<=>(other) ⇒ Object
:nodoc:
21 22 23 24 25 26 27 28 29 30 |
# File 'lib/rubygems/source/lock.rb', line 21 def <=>(other) # :nodoc: case other when Gem::Source::Lock then @wrapped <=> other.wrapped when Gem::Source then 1 else nil end end |
#==(other) ⇒ Object
:nodoc:
32 33 34 |
# File 'lib/rubygems/source/lock.rb', line 32 def ==(other) # :nodoc: 0 == (self <=> other) end |
#fetch_spec(name_tuple) ⇒ Object
Delegates to the wrapped source’s fetch_spec method.
43 44 45 |
# File 'lib/rubygems/source/lock.rb', line 43 def fetch_spec(name_tuple) @wrapped.fetch_spec name_tuple end |
#hash ⇒ Object
:nodoc:
36 37 38 |
# File 'lib/rubygems/source/lock.rb', line 36 def hash # :nodoc: @wrapped.hash ^ 3 end |
#uri ⇒ Object
:nodoc:
47 48 49 |
# File 'lib/rubygems/source/lock.rb', line 47 def uri # :nodoc: @wrapped.uri end |