Class: Bundler::Fetcher::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler/fetcher/base.rb

Direct Known Subclasses

CompactIndex, Dependency, Index

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(downloader, remote, display_uri) ⇒ Base

Returns a new instance of Base.



9
10
11
12
13
14
# File 'lib/bundler/fetcher/base.rb', line 9

def initialize(downloader, remote, display_uri)
  raise "Abstract class" if self.class == Base
  @downloader = downloader
  @remote = remote
  @display_uri = display_uri
end

Instance Attribute Details

#display_uriObject (readonly)

Returns the value of attribute display_uri.



6
7
8
# File 'lib/bundler/fetcher/base.rb', line 6

def display_uri
  @display_uri
end

#downloaderObject (readonly)

Returns the value of attribute downloader.



5
6
7
# File 'lib/bundler/fetcher/base.rb', line 5

def downloader
  @downloader
end

#remoteObject (readonly)

Returns the value of attribute remote.



7
8
9
# File 'lib/bundler/fetcher/base.rb', line 7

def remote
  @remote
end

Instance Method Details

#api_fetcher?Boolean

Returns:

  • (Boolean)


36
37
38
# File 'lib/bundler/fetcher/base.rb', line 36

def api_fetcher?
  false
end

#available?Boolean

Returns:

  • (Boolean)


32
33
34
# File 'lib/bundler/fetcher/base.rb', line 32

def available?
  true
end

#fetch_uriObject



20
21
22
23
24
25
26
27
28
29
30
# File 'lib/bundler/fetcher/base.rb', line 20

def fetch_uri
  @fetch_uri ||= begin
    if remote_uri.host == "rubygems.org"
      uri = remote_uri.dup
      uri.host = "index.rubygems.org"
      uri
    else
      remote_uri
    end
  end
end

#remote_uriObject



16
17
18
# File 'lib/bundler/fetcher/base.rb', line 16

def remote_uri
  @remote.uri
end