get system architecture in ruby

To get the system architecture in Ruby, you can use the RbConfig::CONFIG constant, which provides configuration information about the Ruby installation, including the architecture.

main.rb
arch = RbConfig::CONFIG['arch']
puts "System Architecture: #{arch}"
68 chars
3 lines

This code will output the system architecture of the Ruby installation, for example:

main.rb
System Architecture: x86_64-darwin19
37 chars
2 lines

related categories

gistlibby LogSnag