Class: Gem::DependencyResolver::ActivationRequest

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

Overview

Specifies a Specification object that should be activated. Also contains a dependency that was used to introduce this activation.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(spec, req, others_possible = true) ⇒ ActivationRequest

Returns a new instance of ActivationRequest.



353
354
355
356
357
# File 'lib/rubygems/dependency_resolver.rb', line 353

def initialize(spec, req, others_possible=true)
  @spec = spec
  @request = req
  @others_possible = others_possible
end

Instance Attribute Details

#requestObject (readonly)

Returns the value of attribute request



359
360
361
# File 'lib/rubygems/dependency_resolver.rb', line 359

def request
  @request
end

#specObject (readonly)

Returns the value of attribute spec



359
360
361
# File 'lib/rubygems/dependency_resolver.rb', line 359

def spec
  @spec
end

Instance Method Details

#==(other) ⇒ Object



401
402
403
404
405
406
407
408
409
410
# File 'lib/rubygems/dependency_resolver.rb', line 401

def ==(other)
  case other
  when Gem::Specification
    @spec == other
  when ActivationRequest
    @spec == other.spec && @request == other.request
  else
    false
  end
end

#download(path) ⇒ Object



391
392
393
394
395
396
397
398
399
# File 'lib/rubygems/dependency_resolver.rb', line 391

def download(path)
  if @spec.respond_to? :source
    source = @spec.source
  else
    source = Gem.sources.first
  end

  source.download full_spec, path
end

#full_nameObject



379
380
381
# File 'lib/rubygems/dependency_resolver.rb', line 379

def full_name
  @spec.full_name
end

#full_specObject



387
388
389
# File 'lib/rubygems/dependency_resolver.rb', line 387

def full_spec
  Gem::Specification === @spec ? @spec : @spec.spec
end

#installed?Boolean

Indicates if the requested gem has already been installed.

Returns:

  • (Boolean)


415
416
417
418
419
420
421
# File 'lib/rubygems/dependency_resolver.rb', line 415

def installed?
  this_spec = full_spec

  Gem::Specification.any? do |s|
    s == this_spec
  end
end

#nameObject



375
376
377
# File 'lib/rubygems/dependency_resolver.rb', line 375

def name
  @spec.name
end

#others_possible?Boolean

Indicate if this activation is one of a set of possible requests for the same Dependency request.

Returns:

  • (Boolean)


364
365
366
# File 'lib/rubygems/dependency_resolver.rb', line 364

def others_possible?
  @others_possible
end

#parentObject

Return the ActivationRequest that contained the dependency that we were activated for.



371
372
373
# File 'lib/rubygems/dependency_resolver.rb', line 371

def parent
  @request.requester
end

#versionObject



383
384
385
# File 'lib/rubygems/dependency_resolver.rb', line 383

def version
  @spec.version
end