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.



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

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.



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

def dependencies
  @dependencies
end

#nameObject (readonly)

Returns the value of attribute name.



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

def name
  @name
end

#setObject (readonly)

:nodoc:



72
73
74
# File 'lib/rubygems/dependency_resolver.rb', line 72

def set
  @set
end

#versionObject (readonly)

Returns the value of attribute version.



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

def version
  @version
end

Instance Method Details

#==(other) ⇒ Object

:nodoc:



85
86
87
88
89
90
91
# File 'lib/rubygems/dependency_resolver.rb', line 85

def == other # :nodoc:
  self.class === other and
    @set          == other.set and
    @name         == other.name and
    @version      == other.version and
    @dependencies == other.dependencies
end

#full_nameObject



93
94
95
# File 'lib/rubygems/dependency_resolver.rb', line 93

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