Class: Bundler::Resolver::SpecGroup
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/bundler/resolver/spec_group.rb |
Class Method Summary
- .new(specs) ⇒ SpecGroup constructor
Instance Attribute Summary
- #empty? ⇒ Boolean readonly
- #specs readonly
Instance Method Summary
- #==(other)
- #dependencies
- #merge(other)
- #name
- #source
- #to_s
- #to_specs(force_ruby_platform)
- #version
- #sorted_spec_names protected
- #__dependencies(spec) private
- #equivalent?(other) ⇒ Boolean private
- #exemplary_spec private
- #metadata_dependencies(spec) private
- #metadata_dependency(name, requirement) private
Constructor Details
.new(specs) ⇒ SpecGroup
Instance Attribute Details
#empty? ⇒ Boolean
(readonly)
[ GitHub ]
# File 'lib/bundler/resolver/spec_group.rb', line 12
def empty? @specs.empty? end
#specs (readonly)
[ GitHub ]# File 'lib/bundler/resolver/spec_group.rb', line 6
attr_reader :specs
Instance Method Details
#==(other)
[ GitHub ]# File 'lib/bundler/resolver/spec_group.rb', line 46
def ==(other) sorted_spec_names == other.sorted_spec_names end
#__dependencies(spec) (private)
[ GitHub ]# File 'lib/bundler/resolver/spec_group.rb', line 74
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 40
def dependencies @dependencies ||= @specs.map do |spec| __dependencies(spec) + (spec) end.flatten.uniq.sort end
#equivalent?(other) ⇒ Boolean
(private)
# File 'lib/bundler/resolver/spec_group.rb', line 66
def equivalent?(other) name == other.name && version == other.version && source == other.source && dependencies == other.dependencies end
#exemplary_spec (private)
[ GitHub ]# File 'lib/bundler/resolver/spec_group.rb', line 70
def exemplary_spec @specs.first end
#merge(other)
[ GitHub ]# File 'lib/bundler/resolver/spec_group.rb', line 50
def merge(other) return false unless equivalent?(other) @specs |= other.specs true end
#metadata_dependencies(spec) (private)
[ GitHub ]# File 'lib/bundler/resolver/spec_group.rb', line 83
def (spec) [ ("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 90
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 16
def name @name ||= exemplary_spec.name end
#sorted_spec_names (protected)
[ GitHub ]# File 'lib/bundler/resolver/spec_group.rb', line 60
def sorted_spec_names @specs.map(&:full_name).sort end
#source
[ GitHub ]# File 'lib/bundler/resolver/spec_group.rb', line 24
def source @source ||= exemplary_spec.source end
#to_s
[ GitHub ]# File 'lib/bundler/resolver/spec_group.rb', line 36
def to_s sorted_spec_names.join(", ") end
#to_specs(force_ruby_platform)
[ GitHub ]# 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
#version
[ GitHub ]# File 'lib/bundler/resolver/spec_group.rb', line 20
def version @version ||= exemplary_spec.version end