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.
-
.ruby_version ⇒ #<=>, #to_s
A Version object representing the current Ruby release, without prerelease suffixes.
-
.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.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/farce/system.rb', line 32 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 |
.ruby_version ⇒ #<=>, #to_s
A Version object representing the current Ruby release, without prerelease suffixes. Safe to call from any Ractor.
19 |
# File 'lib/farce/system.rb', line 19 def self.ruby_version = RUBY_VERSION |
.windows? ⇒ Boolean
Whether the current operating system is Windows. Safe to call from any Ractor.
24 |
# File 'lib/farce/system.rb', line 24 def self.windows? = WINDOWS |