Class: Bundler::Resolver::SpecGroup

Inherits:
Array
  • Object
show all
Includes:
GemHelpers
Defined in:
lib/bundler/resolver.rb

Constant Summary

Constant Summary

Constants included from GemHelpers

GemHelpers::GENERICS, GemHelpers::GENERIC_CACHE

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Methods included from GemHelpers

#generic

Constructor Details

- (SpecGroup) initialize(a)



32
33
34
35
36
37
38
39
40
41
42
# File 'lib/bundler/resolver.rb', line 32

def initialize(a)
  super
  @required_by  = []
  @activated    = []
  @dependencies = nil
  @specs        = {}

  ALL.each do |p|
    @specs[p] = reverse.find { |s| s.match_platform(p) }
  end
end

Instance Attribute Details

- (Object) activated (readonly)

Returns the value of attribute activated



30
31
32
# File 'lib/bundler/resolver.rb', line 30

def activated
  @activated
end

- (Object) required_by (readonly)

Returns the value of attribute required_by



30
31
32
# File 'lib/bundler/resolver.rb', line 30

def required_by
  @required_by
end

Instance Method Details

- (Object) activate_platform(platform)



66
67
68
69
70
71
72
# File 'lib/bundler/resolver.rb', line 66

def activate_platform(platform)
  unless @activated.include?(platform)
    @activated << platform
    return __dependencies[platform] || []
  end
  []
end

- (Boolean) for?(platform)



86
87
88
# File 'lib/bundler/resolver.rb', line 86

def for?(platform)
  @specs[platform]
end

- (Object) initialize_copy(o)



44
45
46
47
48
# File 'lib/bundler/resolver.rb', line 44

def initialize_copy(o)
  super
  @required_by = o.required_by.dup
  @activated   = o.activated.dup
end

- (Object) name



74
75
76
# File 'lib/bundler/resolver.rb', line 74

def name
  @name ||= first.name
end

- (Object) source



82
83
84
# File 'lib/bundler/resolver.rb', line 82

def source
  @source ||= first.source
end

- (Object) to_s



90
91
92
# File 'lib/bundler/resolver.rb', line 90

def to_s
  "#{name} (#{version})"
end

- (Object) to_specs



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/bundler/resolver.rb', line 50

def to_specs
  specs = {}

  @activated.each do |p|
    if s = @specs[p]
      platform = generic(Gem::Platform.new(s.platform))
      next if specs[platform]

      lazy_spec = LazySpecification.new(name, version, platform, source)
      lazy_spec.dependencies.replace s.dependencies
      specs[platform] = lazy_spec
    end
  end
  specs.values
end

- (Object) version



78
79
80
# File 'lib/bundler/resolver.rb', line 78

def version
  @version ||= first.version
end