Sha256: 1e5cacb7d06cc1946a3c73728322098e8daeb5b74f3600cf07dc2f24d5796c27

Contents?: true

Size: 1.05 KB

Versions: 27

Compression:

Stored size: 1.05 KB

Contents

# encoding: ascii-8bit

# Copyright 2014 Ball Aerospace & Technologies Corp.
# All Rights Reserved.
#
# This program is free software; you can modify and/or redistribute it
# under the terms of the GNU General Public License
# as published by the Free Software Foundation; version 3 with
# attribution addendums as found in the LICENSE.txt

# COSMOS specific additions to the Ruby Kernel module
module Kernel
  # @return [Boolean] Whether the current platform is Windows
  def is_windows?
    _, platform, *_ = RUBY_PLATFORM.split("-")
    result = false
    if platform == 'mswin32' or platform == 'mingw32'
      result = true
    end
    return result
  end

  # @return [Boolean] Whether the current platform is Mac
  def is_mac?
    _, platform, *_ = RUBY_PLATFORM.split("-")
    result = false
    if platform =~ /darwin/
      result = true
    end
    return result
  end

  # @param start [Integer] The number of stack entries to skip
  # @return [Symbol] The name of the calling method
  def calling_method(start = 1)
    caller[start][/`([^']*)'/, 1].intern
  end
end

Version data entries

27 entries across 27 versions & 1 rubygems

Version Path
cosmos-3.9.2 lib/cosmos/core_ext/kernel.rb
cosmos-3.9.1 lib/cosmos/core_ext/kernel.rb
cosmos-3.8.3 lib/cosmos/core_ext/kernel.rb
cosmos-3.8.2 lib/cosmos/core_ext/kernel.rb
cosmos-3.8.1 lib/cosmos/core_ext/kernel.rb
cosmos-3.8.0 lib/cosmos/core_ext/kernel.rb
cosmos-3.7.1 lib/cosmos/core_ext/kernel.rb
cosmos-3.7.0 lib/cosmos/core_ext/kernel.rb
cosmos-3.6.3 lib/cosmos/core_ext/kernel.rb
cosmos-3.6.2 lib/cosmos/core_ext/kernel.rb
cosmos-3.6.1 lib/cosmos/core_ext/kernel.rb
cosmos-3.6.0 lib/cosmos/core_ext/kernel.rb
cosmos-3.5.3 lib/cosmos/core_ext/kernel.rb
cosmos-3.5.2 lib/cosmos/core_ext/kernel.rb
cosmos-3.5.0 lib/cosmos/core_ext/kernel.rb
cosmos-3.4.2 lib/cosmos/core_ext/kernel.rb
cosmos-3.4.1 lib/cosmos/core_ext/kernel.rb
cosmos-3.4.0 lib/cosmos/core_ext/kernel.rb
cosmos-3.3.3 lib/cosmos/core_ext/kernel.rb
cosmos-3.3.2 lib/cosmos/core_ext/kernel.rb