Class: Gem::Source::Lock

Inherits:
Gem::Source show all
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

FILES

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Gem::Source

#api_uri, #cache_dir, #dependency_resolver_set, #download, #hash, #load_specs, #pretty_print, #update_cache?

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

#wrappedObject (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.



39
40
41
# File 'lib/rubygems/source/lock.rb', line 39

def fetch_spec name_tuple
  @wrapped.fetch_spec name_tuple
end

#uriObject

:nodoc:



43
44
45
# File 'lib/rubygems/source/lock.rb', line 43

def uri # :nodoc:
  @wrapped.uri
end