module Spark::Helper::System::Methods

Public Instance Methods

jruby?() click to toggle source
# File lib/spark/helper/system.rb, line 19
def jruby?
  RbConfig::CONFIG['ruby_install_name'] == 'jruby'
end
memory_usage() click to toggle source

Memory usage in kb

# File lib/spark/helper/system.rb, line 28
def memory_usage
  if jruby?
    runtime = java.lang.Runtime.getRuntime
    (runtime.totalMemory - runtime.freeMemory) >> 10
  elsif windows?
    # not yet
  else
    `ps -o rss= -p #{Process.pid}`.to_i
  end
end
mri?() click to toggle source
# File lib/spark/helper/system.rb, line 15
def mri?
  RbConfig::CONFIG['ruby_install_name'] == 'ruby'
end
pry?() click to toggle source
# File lib/spark/helper/system.rb, line 23
def pry?
  !!Thread.current[:__pry__]
end
windows?() click to toggle source
# File lib/spark/helper/system.rb, line 11
def windows?
  RbConfig::CONFIG['host_os'] =~ /mswin|mingw/
end