Module: Kernel

Defined in:
lib/openc3/core_ext/kernel.rb

Overview

OpenC3 specific additions to the Ruby Kernel module

Instance Method Summary collapse

Instance Method Details

#calling_method(start = 1) ⇒ Symbol

Returns The name of the calling method.

Parameters:

  • start (Integer) (defaults to: 1)

    The number of stack entries to skip

Returns:

  • (Symbol)

    The name of the calling method



42
43
44
# File 'lib/openc3/core_ext/kernel.rb', line 42

def calling_method(start = 1)
  caller[start][/`([^']*)'/, 1].intern
end

#is_mac?Boolean

Returns Whether the current platform is Mac.

Returns:

  • (Boolean)

    Whether the current platform is Mac



31
32
33
34
35
36
37
38
# File 'lib/openc3/core_ext/kernel.rb', line 31

def is_mac?
  _, platform, *_ = RUBY_PLATFORM.split("-")
  result = false
  if /darwin/.match?(platform)
    result = true
  end
  return result
end

#is_windows?Boolean

Returns Whether the current platform is Windows.

Returns:

  • (Boolean)

    Whether the current platform is Windows



26
27
28
# File 'lib/openc3/core_ext/kernel.rb', line 26

def is_windows?
  Gem.win_platform?
end