diff --git a/lib/mspec/guards/platform.rb b/lib/mspec/guards/platform.rb index 03c0fca..c9c258e 100644 --- a/lib/mspec/guards/platform.rb +++ b/lib/mspec/guards/platform.rb @@ -53,6 +53,9 @@ def self.wsl? end end + WORD_SIZE = 1.size * 8 + deprecate_constant :WORD_SIZE + POINTER_SIZE = begin require 'rbconfig/sizeof' RbConfig::SIZEOF["void*"] * 8 @@ -66,6 +69,11 @@ def self.wsl? [0].pack('l!').size end + def self.wordsize?(size) + warn "#wordsize? is deprecated, use #c_long_size?" + size == WORD_SIZE + end + def self.pointer_size?(size) size == POINTER_SIZE end @@ -91,6 +99,9 @@ def match? match &&= PlatformGuard.os?(*value) when :pointer_size match &&= PlatformGuard.pointer_size? value + when :wordsize + warn ":wordsize is deprecated, use :c_long_size" + match &&= PlatformGuard.wordsize? value when :c_long_size match &&= PlatformGuard::c_long_size? value end