Sha256: b3da07b779eb5354a17a84d5350ee607d05b6d77c08be0cc2d0028844d8b6e9a

Contents?: true

Size: 318 Bytes

Versions: 42

Compression:

Stored size: 318 Bytes

Contents

# frozen_string_literal: true

require 'etc'

module Switchman
  class Environment
    def self.cpu_count(nproc_bin = 'nproc')
      return Etc.nprocessors if Etc.respond_to?(:nprocessors)

      `#{nproc_bin}`.to_i
    rescue Errno::ENOENT
      # an environment where nproc` isnt available
      0
    end
  end
end

Version data entries

42 entries across 42 versions & 1 rubygems

Version Path
switchman-3.4.2 lib/switchman/environment.rb
switchman-3.4.1 lib/switchman/environment.rb
switchman-3.4.0 lib/switchman/environment.rb
switchman-3.3.7 lib/switchman/environment.rb
switchman-3.3.6 lib/switchman/environment.rb
switchman-3.3.5 lib/switchman/environment.rb
switchman-3.3.4 lib/switchman/environment.rb
switchman-3.3.3 lib/switchman/environment.rb
switchman-3.3.2 lib/switchman/environment.rb
switchman-3.3.1 lib/switchman/environment.rb
switchman-3.3.0 lib/switchman/environment.rb
switchman-3.2.1 lib/switchman/environment.rb
switchman-3.2.0 lib/switchman/environment.rb
switchman-3.1.3 lib/switchman/environment.rb
switchman-3.1.2 lib/switchman/environment.rb
switchman-3.1.1 lib/switchman/environment.rb
switchman-3.1.0 lib/switchman/environment.rb
switchman-3.0.24 lib/switchman/environment.rb
switchman-3.0.23 lib/switchman/environment.rb
switchman-3.0.22 lib/switchman/environment.rb