module RubyInfo

Constants

VERSION

Public Class Methods

[](what) click to toggle source
# File lib/ruby_info.rb, line 9
def [](what)
  send what
end
all() click to toggle source
# File lib/ruby_info.rb, line 17
def all
  Hash[ list.map{ |l| [l, self.public_send(l)] }]
end
list() click to toggle source
# File lib/ruby_info.rb, line 13
def list
  singleton_methods.map(&:to_sym) - [:[], :list, :all]
end

Public Instance Methods

child_program_status() click to toggle source
# File lib/ruby_info.rb, line 47
def child_program_status
  $CHILD_STATUS
end
current_callstack() click to toggle source
# File lib/ruby_info.rb, line 123
def current_callstack
  caller
end
current_file() click to toggle source

# # current info

# File lib/ruby_info.rb, line 99
def current_file #  __FILE__
  return $` if caller[0].rindex(/:\d+(:in `.*')?$/)
end
current_file_directory() click to toggle source
# File lib/ruby_info.rb, line 107
def current_file_directory
  if current_file[0,1] == '(' && current_file[-1,1] == ')'
    current_file
  else
    File.dirname(current_file)
  end
end
current_line() click to toggle source
# File lib/ruby_info.rb, line 115
def current_line # __LINE__
  return $1.to_i if caller[0].rindex( /:(\d+)(:in `.*')?$/ )
end
current_method() click to toggle source
# File lib/ruby_info.rb, line 119
def current_method # __method__ (except aliases)
  return $1.to_sym if caller(1)[0].rindex( /\`([^\']+)\'/ )
end
debug() click to toggle source
# File lib/ruby_info.rb, line 189
def debug
  $DEBUG
end
debug_activated?() click to toggle source
# File lib/ruby_info.rb, line 193
def debug_activated?
  !! $DEBUG
end
encoding_aliases() click to toggle source
# File lib/ruby_info.rb, line 170
def encoding_aliases
  Encoding.aliases
end
encodings() click to toggle source
# File lib/ruby_info.rb, line 166
def encodings
  Encoding.name_list
end
env() click to toggle source

# # system info

# File lib/ruby_info.rb, line 54
def env
  ::ENV
end
external_encoding() click to toggle source
# File lib/ruby_info.rb, line 158
def external_encoding
  Encoding.default_external
end
gc() click to toggle source
# File lib/ruby_info.rb, line 70
def gc
  GC.stat
end
gets_separator() click to toggle source
# File lib/ruby_info.rb, line 142
def gets_separator
  $/
end
global_constants() click to toggle source
# File lib/ruby_info.rb, line 208
def global_constants
  Object.constants
end
global_variables() click to toggle source

# # ruby objects

# File lib/ruby_info.rb, line 204
def global_variables
  Object.send :global_variables
end
hostname() click to toggle source

# # network info

# File lib/ruby_info.rb, line 92
def hostname
  Socket.gethostname
end
internal_encoding() click to toggle source
# File lib/ruby_info.rb, line 162
def internal_encoding
  Encoding.default_internal
end
join_separator() click to toggle source
# File lib/ruby_info.rb, line 146
def join_separator
  $,
end
last_exception() click to toggle source
# File lib/ruby_info.rb, line 197
def last_exception
  $!
end
last_input() click to toggle source
# File lib/ruby_info.rb, line 138
def last_input
  $_
end
last_input_file() click to toggle source

# # input / string info

# File lib/ruby_info.rb, line 130
def last_input_file
  $FILENAME
end
last_input_line_number() click to toggle source
# File lib/ruby_info.rb, line 134
def last_input_line_number
  $.
end
load_path() click to toggle source
# File lib/ruby_info.rb, line 66
def load_path
  $:
end
loaded_programs() click to toggle source
# File lib/ruby_info.rb, line 35
def loaded_programs
  $"
end
os() click to toggle source
# File lib/ruby_info.rb, line 58
def os
  RbConfig::CONFIG['host_os']
end
print_separator() click to toggle source
process_id() click to toggle source
# File lib/ruby_info.rb, line 62
def process_id
  $$
end
program_arguments() click to toggle source
# File lib/ruby_info.rb, line 31
def program_arguments
  $*
end
program_data() click to toggle source
# File lib/ruby_info.rb, line 39
def program_data
  defined?(::DATA) && DATA
end
program_name() click to toggle source

# # program info

# File lib/ruby_info.rb, line 27
def program_name
  $0
end
ruby_description() click to toggle source
# File lib/ruby_info.rb, line 231
def ruby_description
  ::RUBY_DESCRIPTION
end
ruby_engine() click to toggle source
# File lib/ruby_info.rb, line 239
def ruby_engine # also see the ruby_engine gem
  defined?(::RUBY_ENGINE) && ::RUBY_ENGINE
end
ruby_patchlevel() click to toggle source
# File lib/ruby_info.rb, line 227
def ruby_patchlevel
  ::RUBY_PATCHLEVEL
end
ruby_platform() click to toggle source
# File lib/ruby_info.rb, line 243
def ruby_platform
  ::RUBY_PLATFORM
end
ruby_release_date() click to toggle source
# File lib/ruby_info.rb, line 235
def ruby_release_date
  ::RUBY_RELEASE_DATE
end
ruby_revision() click to toggle source
# File lib/ruby_info.rb, line 247
def ruby_revision
  defined?(::RUBY_REVISION) && ::RUBY_REVISION
end
ruby_version() click to toggle source

# # ruby info

# File lib/ruby_info.rb, line 223
def ruby_version # also see the ruby_version gem
  ::RUBY_VERSION
end
script_lines() click to toggle source
# File lib/ruby_info.rb, line 43
def script_lines
  defined?(::SCRIPT_LINES__) && SCRIPT_LINES__
end
security_level() click to toggle source

# # misc

# File lib/ruby_info.rb, line 177
def security_level
  $SAFE
end
signals() click to toggle source
# File lib/ruby_info.rb, line 216
def signals
  Signal.list
end
split_separator() click to toggle source
# File lib/ruby_info.rb, line 154
def split_separator
  $;
end
system_call_errors() click to toggle source
# File lib/ruby_info.rb, line 212
def system_call_errors
  Errno.constants
end
user_home() click to toggle source
# File lib/ruby_info.rb, line 85
def user_home
  Dir.home
end
user_login() click to toggle source

# # user info

# File lib/ruby_info.rb, line 77
def user_login
  Etc.getlogin
end
user_name() click to toggle source
# File lib/ruby_info.rb, line 81
def user_name
  Etc.getpwnam(user_login).gecos.split(',')[0]
end
verbose() click to toggle source
# File lib/ruby_info.rb, line 181
def verbose
  $VERBOSE
end
warnings_activated?() click to toggle source
# File lib/ruby_info.rb, line 185
def warnings_activated?
  !! $VERBOSE
end
working_directory() click to toggle source
# File lib/ruby_info.rb, line 103
def working_directory
  Dir.pwd
end