Class: Bundler::Resolver::SpecGroup
Relationships & Source Files | |
Inherits: | Object |
Defined in: | lib/bundler/resolver/spec_group.rb |
Class Method Summary
- .new(specs, relevant_platforms) ⇒ SpecGroup constructor
Instance Attribute Summary
- #activated_platforms rw
- #force_ruby_platform rw
- #name rw
- #source rw
- #version rw
Instance Method Summary
Constructor Details
.new(specs, relevant_platforms) ⇒ SpecGroup
Instance Attribute Details
#activated_platforms (rw)
[ GitHub ]# File 'lib/bundler/resolver/spec_group.rb', line 7
attr_accessor :activated_platforms, :force_ruby_platform
#force_ruby_platform (rw)
[ GitHub ]# File 'lib/bundler/resolver/spec_group.rb', line 7
attr_accessor :activated_platforms, :force_ruby_platform
#name (rw)
[ GitHub ]#source (rw)
[ GitHub ]#version (rw)
[ GitHub ]Instance Method Details
#==(other)
[ GitHub ]# File 'lib/bundler/resolver/spec_group.rb', line 39
def ==(other) return unless other.is_a?(SpecGroup) name == other.name && version == other.version && sorted_activated_platforms == other.sorted_activated_platforms && source == other.source end
#__dependencies(spec) (private)
[ GitHub ]# File 'lib/bundler/resolver/spec_group.rb', line 67
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_for_activated_platforms
[ GitHub ]# File 'lib/bundler/resolver/spec_group.rb', line 33
def dependencies_for_activated_platforms @dependencies_for_activated_platforms ||= @specs.map do |spec| __dependencies(spec) + (spec) end.flatten.uniq end
#eql?(other) ⇒ Boolean
# File 'lib/bundler/resolver/spec_group.rb', line 47
def eql?(other) return unless other.is_a?(SpecGroup) name.eql?(other.name) && version.eql?(other.version) && sorted_activated_platforms.eql?(other.sorted_activated_platforms) && source.eql?(other.source) end
#hash
[ GitHub ]# File 'lib/bundler/resolver/spec_group.rb', line 55
def hash name.hash ^ version.hash ^ sorted_activated_platforms.hash ^ source.hash end
#metadata_dependencies(spec) (private)
[ GitHub ]# File 'lib/bundler/resolver/spec_group.rb', line 76
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 85
def (name, requirement) return if requirement.nil? || requirement.none? Dependency.new("#{name}\0", requirement) end
#sorted_activated_platforms (protected)
[ GitHub ]# File 'lib/bundler/resolver/spec_group.rb', line 61
def sorted_activated_platforms activated_platforms.sort_by(&:to_s) end
#to_s
[ GitHub ]# File 'lib/bundler/resolver/spec_group.rb', line 28
def to_s activated_platforms_string = sorted_activated_platforms.join(", ") "#{name} (#{version}) (#{activated_platforms_string})" end
#to_specs
[ GitHub ]# File 'lib/bundler/resolver/spec_group.rb', line 19
def to_specs @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