Issue #16742 has been updated by nobu (Nobuyoshi Nakada).


Is `host_os` what you want to see?
`RbConfig::CONFIG['host_os']` is bare value by config.guess, like "linux-gnu", "darwin19.4.0", etc.
`RUBY_PLATFORM` consists of "target_cpu" and "target_os" instead.

----------------------------------------
Feature #16742: RbConfig.windows? and RbConfig.host_os
https://bugs.ruby-lang.org/issues/16742#change-84990

* Author: Eregon (Benoit Daloze)
* Status: Open
* Priority: Normal
----------------------------------------
I think adding these two methods would greatly clarify platform checks:
```ruby
RbConfig.windows? # obvious, much clearer than RUBY_PLATFORM =~ /(mswin|mingw)/
RbConfig.host_os # same as RbConfig::CONFIG['host_os'], but much shorter
```

`RbConfig::CONFIG['host_os']` is too long and feels like digging in the internals even though it's such a simple thing to query.


For comparison, there is already a `RbConfig.ruby` method on `RbConfig`, which helps avoiding the boilerplate to access `RbConfig::CONFIG` manually.

Thoughts?



-- 
https://bugs.ruby-lang.org/

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>