Class: GemMirror::VersionsFetcher

Inherits:
Object
  • Object
show all
Defined in:
lib/gem_mirror/versions_fetcher.rb

Overview

The VersionsFetcher class is used for retrieving the file that contains all registered Gems and their versions.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source) ⇒ VersionsFetcher

Returns a new instance of VersionsFetcher.

Parameters:



17
18
19
# File 'lib/gem_mirror/versions_fetcher.rb', line 17

def initialize(source)
  @source = source
end

Instance Attribute Details

#sourceSource (readonly)

Returns:



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/gem_mirror/versions_fetcher.rb', line 11

class VersionsFetcher
  attr_reader :source

  ##
  # @param [Source] source
  #
  def initialize(source)
    @source = source
  end

  ##
  # @return [GemMirror::VersionsFile]
  #
  def fetch
    GemMirror.configuration.logger.info(
      "Updating #{source.name} (#{source.host})"
    )

    VersionsFile.load(source.fetch_versions)
  end
end

Instance Method Details

#fetchGemMirror::VersionsFile



24
25
26
27
28
29
30
# File 'lib/gem_mirror/versions_fetcher.rb', line 24

def fetch
  GemMirror.configuration.logger.info(
    "Updating #{source.name} (#{source.host})"
  )

  VersionsFile.load(source.fetch_versions)
end