123456789_123456789_123456789_123456789_123456789_

Class: Bundler::Resolver::SpecGroup

Relationships & Source Files
Inherits: Object
Defined in: lib/bundler/resolver/spec_group.rb

Class Method Summary

Instance Attribute Summary

Instance Method Summary

Constructor Details

.new(specs) ⇒ SpecGroup

[ GitHub ]

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

def initialize(specs)
  @specs = specs
end

Instance Attribute Details

#empty?Boolean (readonly)

[ GitHub ]

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

def empty?
  @specs.empty?
end

Instance Method Details

#__dependencies(spec) (private)

[ GitHub ]

  
# File 'lib/bundler/resolver/spec_group.rb', line 57

def __dependencies(spec)
  dependencies = []
  spec.dependencies.each do |dep|
    next if dep.type == :development
    dependencies << Dependency.new(dep.name, dep.requirement)
  end
  dependencies
end

#dependencies

[ GitHub ]

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

def dependencies
  @dependencies ||= @specs.map do |spec|
    __dependencies(spec) + (spec)
  end.flatten.uniq
end

#exemplary_spec (private)

[ GitHub ]

  
# File 'lib/bundler/resolver/spec_group.rb', line 53

def exemplary_spec
  @specs.first
end

#metadata_dependencies(spec) (private)

[ GitHub ]

  
# File 'lib/bundler/resolver/spec_group.rb', line 66

def (spec)
  return [] if spec.is_a?(LazySpecification)

  [
    ("Ruby", spec.required_ruby_version),
    ("RubyGems", spec.required_rubygems_version),
  ].compact
end

#metadata_dependency(name, requirement) (private)

[ GitHub ]

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

def (name, requirement)
  return if requirement.nil? || requirement.none?

  Dependency.new("#{name}\0", requirement)
end

#name

[ GitHub ]

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

def name
  @name ||= exemplary_spec.name
end

#sorted_spec_names (protected)

[ GitHub ]

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

def sorted_spec_names
  @sorted_spec_names ||= @specs.map(&:full_name).sort
end

#source

[ GitHub ]

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

def source
  @source ||= exemplary_spec.source
end

#to_s

[ GitHub ]

  
# File 'lib/bundler/resolver/spec_group.rb', line 35

def to_s
  sorted_spec_names.join(", ")
end

#to_specs(force_ruby_platform)

[ GitHub ]

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

def to_specs(force_ruby_platform)
  @specs.map do |s|
    lazy_spec = LazySpecification.new(name, version, s.platform, source)
    lazy_spec.force_ruby_platform = force_ruby_platform
    lazy_spec.dependencies.replace s.dependencies
    lazy_spec
  end
end

#version

[ GitHub ]

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

def version
  @version ||= exemplary_spec.version
end