Module: Farce::System
- Defined in:
- lib/farce/system.rb
Overview
Information about the system running Farce.
Class Method Summary collapse
-
.cpu_count(type = nil) ⇒ Integer?
Number of logical CPUs, optionally limited to a CPU type.
-
.windows? ⇒ Boolean
Whether the current operating system is Windows.
Class Method Details
.cpu_count(type = nil) ⇒ Integer?
Number of logical CPUs, optionally limited to a CPU type. Returns nil when the platform cannot report the requested CPU type. Safe to call from any Ractor.
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/farce/system.rb', line 24 def self.cpu_count(type = nil) case type when nil if defined?(Internal::Darwin) && Internal::Darwin.respond_to?(:cpu_count) Internal::Darwin.cpu_count else Etc.nprocessors end when :performance, :efficiency method = :"#{type}_cpu_count" Internal::Darwin.public_send(method) if defined?(Internal::Darwin) && Internal::Darwin.respond_to?(method) else raise ArgumentError, "invalid CPU type: #{type.inspect}" end end |
.windows? ⇒ Boolean
Whether the current operating system is Windows. Safe to call from any Ractor.
16 |
# File 'lib/farce/system.rb', line 16 def self.windows? = WINDOWS |