Class: Bundler::Resolver::SpecGroup
- Inherits:
-
Array
- Object
- Array
- Bundler::Resolver::SpecGroup
show all
- Includes:
- GemHelpers
- Defined in:
- lib/bundler/resolver.rb
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
Returns a new instance of SpecGroup.
31
32
33
34
35
36
37
38
39
40
41
|
# File 'lib/bundler/resolver.rb', line 31
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
#activated ⇒ Object
Returns the value of attribute activated.
29
30
31
|
# File 'lib/bundler/resolver.rb', line 29
def activated
@activated
end
|
#required_by ⇒ Object
Returns the value of attribute required_by.
29
30
31
|
# File 'lib/bundler/resolver.rb', line 29
def required_by
@required_by
end
|
Instance Method Details
65
66
67
68
69
70
71
|
# File 'lib/bundler/resolver.rb', line 65
def activate_platform(platform)
unless @activated.include?(platform)
@activated << platform
return __dependencies[platform] || []
end
[]
end
|
#for?(platform) ⇒ Boolean
85
86
87
|
# File 'lib/bundler/resolver.rb', line 85
def for?(platform)
@specs[platform]
end
|
#initialize_copy(o) ⇒ Object
43
44
45
46
47
|
# File 'lib/bundler/resolver.rb', line 43
def initialize_copy(o)
super
@required_by = o.required_by.dup
@activated = o.activated.dup
end
|
#name ⇒ Object
73
74
75
|
# File 'lib/bundler/resolver.rb', line 73
def name
@name ||= first.name
end
|
#source ⇒ Object
81
82
83
|
# File 'lib/bundler/resolver.rb', line 81
def source
@source ||= first.source
end
|
#to_s ⇒ Object
89
90
91
|
# File 'lib/bundler/resolver.rb', line 89
def to_s
"#{name} (#{version})"
end
|
#to_specs ⇒ Object
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
|
# File 'lib/bundler/resolver.rb', line 49
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
|
#version ⇒ Object
77
78
79
|
# File 'lib/bundler/resolver.rb', line 77
def version
@version ||= first.version
end
|