Class: Bundler::Resolver::SpecGroup

Inherits:
Object
  • Object
show all
Defined in:
lib/bundler/resolver/spec_group.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(specs) ⇒ SpecGroup

Returns a new instance of SpecGroup.



8
9
10
# File 'lib/bundler/resolver/spec_group.rb', line 8

def initialize(specs)
  @specs = specs
end

Instance Attribute Details

#specsObject (readonly)

Returns the value of attribute specs.



6
7
8
# File 'lib/bundler/resolver/spec_group.rb', line 6

def specs
  @specs
end

Instance Method Details

#==(other) ⇒ Object



47
48
49
# File 'lib/bundler/resolver/spec_group.rb', line 47

def ==(other)
  sorted_spec_names == other.sorted_spec_names
end

#dependenciesObject



41
42
43
44
45
# File 'lib/bundler/resolver/spec_group.rb', line 41

def dependencies
  @dependencies ||= @specs.flat_map do |spec|
    __dependencies(spec) + (spec)
  end.uniq.sort
end

#empty?Boolean

Returns:

  • (Boolean)


12
13
14
# File 'lib/bundler/resolver/spec_group.rb', line 12

def empty?
  @specs.empty?
end

#merge(other) ⇒ Object



51
52
53
54
55
56
57
# File 'lib/bundler/resolver/spec_group.rb', line 51

def merge(other)
  return false unless equivalent?(other)

  @specs |= other.specs

  true
end

#nameObject



16
17
18
# File 'lib/bundler/resolver/spec_group.rb', line 16

def name
  @name ||= exemplary_spec.name
end

#sourceObject



24
25
26
# File 'lib/bundler/resolver/spec_group.rb', line 24

def source
  @source ||= exemplary_spec.source
end

#to_sObject



37
38
39
# File 'lib/bundler/resolver/spec_group.rb', line 37

def to_s
  sorted_spec_names.join(", ")
end

#to_specs(force_ruby_platform, most_specific_locked_platform) ⇒ Object



28
29
30
31
32
33
34
35
# File 'lib/bundler/resolver/spec_group.rb', line 28

def to_specs(force_ruby_platform, most_specific_locked_platform)
  @specs.map do |s|
    lazy_spec = LazySpecification.from_spec(s)
    lazy_spec.force_ruby_platform = force_ruby_platform
    lazy_spec.most_specific_locked_platform = most_specific_locked_platform
    lazy_spec
  end
end

#versionObject



20
21
22
# File 'lib/bundler/resolver/spec_group.rb', line 20

def version
  @version ||= exemplary_spec.version
end