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



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

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

#dependenciesObject



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

def dependencies
  @dependencies ||= @specs.map do |spec|
    __dependencies(spec) + (spec)
  end.flatten.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



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

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



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

def to_s
  sorted_spec_names.join(", ")
end

#to_specs(force_ruby_platform) ⇒ Object



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

def to_specs(force_ruby_platform)
  @specs.map do |s|
    lazy_spec = LazySpecification.from_spec(s)
    lazy_spec.force_ruby_platform = force_ruby_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