Class: Gem::DependencyResolver::APISpecification

Inherits:
Object
  • Object
show all
Defined in:
lib/rubygems/dependency_resolver.rb

Overview

Represents a specification retrieved via the rubygems.org API. This is used to avoid having to load the full Specification object when all we need is the name, version, and dependencies.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(set, api_data) ⇒ APISpecification

Returns a new instance of APISpecification.



72
73
74
75
76
77
78
79
# File 'lib/rubygems/dependency_resolver.rb', line 72

def initialize(set, api_data)
  @set = set
  @name = api_data[:name]
  @version = Gem::Version.new api_data[:number]
  @dependencies = api_data[:dependencies].map do |name, ver|
    Gem::Dependency.new name, ver.split(/\s*,\s*/)
  end
end

Instance Attribute Details

#dependenciesObject (readonly)

Returns the value of attribute dependencies



81
82
83
# File 'lib/rubygems/dependency_resolver.rb', line 81

def dependencies
  @dependencies
end

#nameObject (readonly)

Returns the value of attribute name



81
82
83
# File 'lib/rubygems/dependency_resolver.rb', line 81

def name
  @name
end

#versionObject (readonly)

Returns the value of attribute version



81
82
83
# File 'lib/rubygems/dependency_resolver.rb', line 81

def version
  @version
end

Instance Method Details

#full_nameObject



83
84
85
# File 'lib/rubygems/dependency_resolver.rb', line 83

def full_name
  "#{@name}-#{@version}"
end