Sha256: ae499567525f96b7d6cbace85bcb1b9d5f1be140c71792556ff85edd96b5fb22

Contents?: true

Size: 753 Bytes

Versions: 7

Compression:

Stored size: 753 Bytes

Contents

module Knapsack
  class Allocator
    def initialize(args={})
      @spec_pattern = args[:spec_pattern] || Config.spec_pattern
      @report_distributor = Knapsack::Distributors::ReportDistributor.new(args)
      @leftover_distributor = Knapsack::Distributors::LeftoverDistributor.new(args)
    end

    def report_node_specs
      @report_node_specs ||= @report_distributor.specs_for_current_node
    end

    def leftover_node_specs
      @leftover_node_specs ||= @leftover_distributor.specs_for_current_node
    end

    def node_specs
      @node_specs ||= report_node_specs + leftover_node_specs
    end

    def stringify_node_specs
      node_specs.join(' ')
    end

    def spec_dir
      @spec_pattern.gsub(/^(.*?)\//).first
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
knapsack-0.5.0 lib/knapsack/allocator.rb
knapsack-0.4.0 lib/knapsack/allocator.rb
knapsack-0.3.0 lib/knapsack/allocator.rb
knapsack-0.2.0 lib/knapsack/allocator.rb
knapsack-0.1.4 lib/knapsack/allocator.rb
knapsack-0.1.3 lib/knapsack/allocator.rb
knapsack-0.1.2 lib/knapsack/allocator.rb