Class: Bundler::Resolver::SpecGroup
- Inherits:
-
Object
- Object
- Bundler::Resolver::SpecGroup
- Defined in:
- lib/bundler/resolver/spec_group.rb
Instance Attribute Summary collapse
-
#activated_platforms ⇒ Object
Returns the value of attribute activated_platforms.
-
#force_ruby_platform ⇒ Object
Returns the value of attribute force_ruby_platform.
-
#name ⇒ Object
Returns the value of attribute name.
-
#source ⇒ Object
Returns the value of attribute source.
-
#version ⇒ Object
Returns the value of attribute version.
Instance Method Summary collapse
- #==(other) ⇒ Object
- #dependencies_for_activated_platforms ⇒ Object
- #eql?(other) ⇒ Boolean
- #hash ⇒ Object
-
#initialize(specs, relevant_platforms) ⇒ SpecGroup
constructor
A new instance of SpecGroup.
- #to_s ⇒ Object
- #to_specs ⇒ Object
Constructor Details
#initialize(specs, relevant_platforms) ⇒ SpecGroup
Returns a new instance of SpecGroup.
9 10 11 12 13 14 15 16 17 |
# File 'lib/bundler/resolver/spec_group.rb', line 9 def initialize(specs, relevant_platforms) @exemplary_spec = specs.first @name = @exemplary_spec.name @version = @exemplary_spec.version @source = @exemplary_spec.source @activated_platforms = relevant_platforms @specs = specs end |
Instance Attribute Details
#activated_platforms ⇒ Object
Returns the value of attribute activated_platforms.
7 8 9 |
# File 'lib/bundler/resolver/spec_group.rb', line 7 def activated_platforms @activated_platforms end |
#force_ruby_platform ⇒ Object
Returns the value of attribute force_ruby_platform.
7 8 9 |
# File 'lib/bundler/resolver/spec_group.rb', line 7 def force_ruby_platform @force_ruby_platform end |
#name ⇒ Object
Returns the value of attribute name.
6 7 8 |
# File 'lib/bundler/resolver/spec_group.rb', line 6 def name @name end |
#source ⇒ Object
Returns the value of attribute source.
6 7 8 |
# File 'lib/bundler/resolver/spec_group.rb', line 6 def source @source end |
#version ⇒ Object
Returns the value of attribute version.
6 7 8 |
# File 'lib/bundler/resolver/spec_group.rb', line 6 def version @version end |
Instance Method Details
#==(other) ⇒ Object
39 40 41 42 43 44 45 |
# 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_for_activated_platforms ⇒ Object
33 34 35 36 37 |
# 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
47 48 49 50 51 52 53 |
# 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 ⇒ Object
55 56 57 |
# File 'lib/bundler/resolver/spec_group.rb', line 55 def hash name.hash ^ version.hash ^ sorted_activated_platforms.hash ^ source.hash end |
#to_s ⇒ Object
28 29 30 31 |
# 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 ⇒ Object
19 20 21 22 23 24 25 26 |
# 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 |