class Bundler::Resolver::SpecGroup - bundler-1.9.9 Documentation

# class Bundler::Resolver::SpecGroup

### Attributes

activated[R]
required_by[R]

### Public Class Methods

new(a) click to toggle source
Calls superclass method

    # File lib/bundler/resolver.rb, line 78
    def initialize(a)
      super
      @required_by  = []
      @activated    = []
      @dependencies = nil
      @specs        = {}

      ALL.each do |p|
        @specs[p] = reverse.find { |s| s.match_platform(p) }
      end
    end

### Public Instance Methods

activate_platform(platform) click to toggle source

    # File lib/bundler/resolver.rb, line 112
    def activate_platform(platform)
      unless @activated.include?(platform)
        if for?(platform)
          @activated << platform
          return __dependencies[platform] || []
        end
      end
      []
    end

dependencies_for_activated_platforms() click to toggle source

    # File lib/bundler/resolver.rb, line 142
    def dependencies_for_activated_platforms
      @activated.map { |p| __dependencies[p] }.flatten
    end

for?(platform) click to toggle source

    # File lib/bundler/resolver.rb, line 134
    def for?(platform)
      @specs[platform]
    end

initialize_copy(o) click to toggle source
Calls superclass method

    # File lib/bundler/resolver.rb, line 90
    def initialize_copy(o)
      super
      @required_by = o.required_by.dup
      @activated   = o.activated.dup
    end

name() click to toggle source

    # File lib/bundler/resolver.rb, line 122
    def name
      @name ||= first.name
    end

platforms_for_dependency_named(dependency) click to toggle source

    # File lib/bundler/resolver.rb, line 146
    def platforms_for_dependency_named(dependency)
      __dependencies.select { |p, deps| deps.map(&:name).include? dependency }.keys
    end

source() click to toggle source

    # File lib/bundler/resolver.rb, line 130
    def source
      @source ||= first.source
    end

to_s() click to toggle source

    # File lib/bundler/resolver.rb, line 138
    def to_s
      "#{name} (#{version})"
    end

to_specs() click to toggle source

    # File lib/bundler/resolver.rb, line 96
    def to_specs
      specs = {}

      @activated.each do |p|
        if s = @specs[p]
          platform = generic(Gem::Platform.new(s.platform))
          next if specs[platform]

          lazy_spec = LazySpecification.new(name, version, platform, source)
          lazy_spec.dependencies.replace s.dependencies
          specs[platform] = lazy_spec
        end
      end
      specs.values
    end

version() click to toggle source

    # File lib/bundler/resolver.rb, line 126
    def version
      @version ||= first.version
    end

### Private Instance Methods

__dependencies() click to toggle source

    # File lib/bundler/resolver.rb, line 152
    def __dependencies
      @dependencies ||= begin
        dependencies = {}
        ALL.each do |p|
          if spec = @specs[p]
            dependencies[p] = []
            spec.dependencies.each do |dep|
              next if dep.type == :development
              dependencies[p] << DepProxy.new(dep, p)
            end
          end
        end
        dependencies
      end
    end