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:



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

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

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

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

Yields:

  • (nil)


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

def install(options = {})
  yield nil
end

#installable_platform?Boolean

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

Returns:

  • (Boolean)


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

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.kind_of? Gem::Source::SpecificFile

  super
end

#pretty_print(q) ⇒ Object

:nodoc:



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

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



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

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