Class: Gem::Resolver::InstalledSpecification

Inherits:
SpecSpecification show all
Defined in:
lib/rubygems/resolver/installed_specification.rb

Overview

An InstalledSpecification represents a gem that is already installed locally.

Instance Attribute Summary

Attributes inherited from Specification

#dependencies, #name, #platform, #required_ruby_version, #required_rubygems_version, #set, #spec, #version

Instance Method Summary collapse

Methods inherited from SpecSpecification

#dependencies, #full_name, #initialize, #name, #platform, #required_ruby_version, #required_rubygems_version, #version

Methods inherited from Specification

#download, #fetch_development_dependencies, #full_name, #initialize, #local?

Constructor Details

This class inherits a constructor from Gem::Resolver::SpecSpecification

Instance Method Details

#==(other) ⇒ Object

:nodoc:



8
9
10
11
12
# File 'lib/rubygems/resolver/installed_specification.rb', line 8

def ==(other) # :nodoc:
  self.class === other &&
    @set  == other.set &&
    @spec == other.spec
end

#install(options = {}) {|nil| ... } ⇒ Object

This is a null install as this specification is already installed. options are ignored.

Yields:

  • (nil)


18
19
20
# File 'lib/rubygems/resolver/installed_specification.rb', line 18

def install(options = {})
  yield nil
end

#installable_platform?Boolean

Returns true if this gem is installable for the current platform.

Returns:

  • (Boolean)


25
26
27
28
29
30
31
# File 'lib/rubygems/resolver/installed_specification.rb', line 25

def installable_platform?
  # BACKCOMPAT If the file is coming out of a specified file, then we
  # ignore the platform. This code can be removed in RG 3.0.
  return true if @source.is_a? Gem::Source::SpecificFile

  super
end

#pretty_print(q) ⇒ Object

:nodoc:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/rubygems/resolver/installed_specification.rb', line 33

def pretty_print(q) # :nodoc:
  q.group 2, "[InstalledSpecification", "]" do
    q.breakable
    q.text "name: #{name}"

    q.breakable
    q.text "version: #{version}"

    q.breakable
    q.text "platform: #{platform}"

    q.breakable
    q.text "dependencies:"
    q.breakable
    q.pp spec.dependencies
  end
end

#sourceObject

The source for this specification



54
55
56
# File 'lib/rubygems/resolver/installed_specification.rb', line 54

def source
  @source ||= Gem::Source::Installed.new
end