Module: Contrast::Utils::OS
- Extended by:
- Components::Scope::InstanceMethods
- Included in:
- Agent::Telemetry::MetricEvent
- Defined in:
- lib/contrast/utils/os.rb,
ext/cs__os_information/cs__os_information.c
Overview
Simple utility used to make OS calls and determine state. For that state which will not change at runtime, such as the operating system, the Utility memoizes to avoid multiple lookups.
Class Method Summary collapse
- .get_system_information ⇒ Object
- .mac? ⇒ Boolean
-
.windows? ⇒ Boolean
Check current OS type returns true if check is correct or false if not.
Methods included from Components::Scope::InstanceMethods
contrast_enter_method_scopes!, contrast_exit_method_scopes!, with_app_scope, with_contrast_scope, with_deserialization_scope, with_split_scope
Class Method Details
.get_system_information ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'ext/cs__os_information/cs__os_information.c', line 11 VALUE contrast_get_system_information() { struct utsname uname_pointer; uname(&uname_pointer); VALUE rb_data_hash = rb_hash_new(); rb_hash_aset(rb_data_hash, rb_str_new2("os_type"), rb_str_new2(uname_pointer.sysname)); rb_hash_aset(rb_data_hash, rb_str_new2("os_version"), rb_str_new2(uname_pointer.release)); rb_hash_aset(rb_data_hash, rb_str_new2("os_complete_version"), rb_str_new2(uname_pointer.version)); rb_hash_aset(rb_data_hash, rb_str_new2("os_arch"), rb_str_new2(uname_pointer.machine)); return rb_data_hash; } |
.mac? ⇒ Boolean
24 25 26 27 |
# File 'lib/contrast/utils/os.rb', line 24 def mac? @_mac = RUBY_PLATFORM.include?('darwin') if @_mac.nil? @_mac end |
.windows? ⇒ Boolean
Check current OS type returns true if check is correct or false if not
18 19 20 21 22 |
# File 'lib/contrast/utils/os.rb', line 18 def windows? return @_windows unless @_windows.nil? @_windows = !(/cygwin|mswin|mingw|bccwin|wince|emx/ =~ RUBY_PLATFORM).nil? end |