Class: Pod::Command::GemIndexCache

Inherits:
Object
  • Object
show all
Defined in:
lib/pod/command/gem_index_cache.rb

Overview

This class is used by Command::GemsHelper to download the Gem Specification index from rubygems.org and provide info about the index.

Instance Method Summary collapse

Instance Method Details

#specsHash Also known as: download_and_cache_specs

A memoized hash of all the rubygem specs. If it is nil, the specs will be downloaded, which will take a few seconds to download.

Returns:

  • (Hash)

    The hash of all rubygems



15
16
17
# File 'lib/pod/command/gem_index_cache.rb', line 15

def specs
  @specs ||= download_specs
end

#specs_with_name(name) ⇒ Array

Get an Array of Gem::NameTuple objects that match a given spec name.

Parameters:

  • name (String)

    The name of the gem to match on (e.g. ‘cocoapods-try’)

Returns:

  • (Array)

    Array of Gem::NameTuple that match the name



31
32
33
34
35
36
37
38
39
40
41
42
# File 'lib/pod/command/gem_index_cache.rb', line 31

def specs_with_name(name)
  matching_specs = @specs.select do |spec|
    spec[0].name == name
  end

  name_tuples = []
  matching_specs.each do |(name_tuple, _)|
    name_tuples << name_tuple
  end

  name_tuples
end