From: Greg.mpls@... Date: 2020-04-11T14:00:39+00:00 Subject: [ruby-core:97830] [Ruby master Feature#16742] RbConfig.windows? and RbConfig.host_os Issue #16742 has been updated by MSP-Greg (Greg L). > it should be false for cygwin too since it also tries to hide the fact you're on Windows. Agreed. I think. I've never worked with the platform. I've seen many gems/repos that have `.windows?`, '.darwin?`, `.jruby?`, `.mingw?`, `mswin?`, etc in their library or test code. Adding any similar predicate methods to Ruby would be helpful. Some use constants (RbConfig::WINDOWS, RbConfig::DARWIN, etc)... ---------------------------------------- Feature #16742: RbConfig.windows? and RbConfig.host_os https://bugs.ruby-lang.org/issues/16742#change-85051 * 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: