Module: Kernel

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

Overview

COSMOS 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



39
40
41
# File 'lib/cosmos/core_ext/kernel.rb', line 39

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



28
29
30
31
32
33
34
35
# File 'lib/cosmos/core_ext/kernel.rb', line 28

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



23
24
25
# File 'lib/cosmos/core_ext/kernel.rb', line 23

def is_windows?
  Gem.win_platform?
end