Sha256: 9af699651a0e4eae81febaa3bbe607c03cb17fecb75ba7de532ce10c360d1faa
Contents?: true
Size: 1.48 KB
Versions: 4
Compression:
Stored size: 1.48 KB
Contents
module CrashLog class SystemInformation class << self def to_hash { :hostname => hostname, :ruby_version => ruby_version, :username => username, :environment => environment, :libraries_loaded => libraries_loaded, :platform => platform, :application_root => application_root, :stage => stage } end def hostname require 'socket' unless defined?(Socket) Socket.gethostname rescue 'UNKNOWN' end def ruby_version "#{RUBY_VERSION rescue '?.?.?'}-p#{RUBY_PATCHLEVEL rescue '???'} #{RUBY_RELEASE_DATE rescue '????-??-??'} #{RUBY_PLATFORM rescue '????'}" end def username ENV['LOGNAME'] || ENV['USER'] || ENV['USERNAME'] || ENV['APACHE_RUN_USER'] || 'UNKNOWN' end def environment if ENV.respond_to?(:to_hash) ENV.to_hash.reject do |k, v| (k =~ /^HTTP_/) || CrashLog.configuration.environment_filters.include?(k) end else {} end end def libraries_loaded Hash[*Gem.loaded_specs.map {|name, gem_specification| [name, gem_specification.version.to_s] }.flatten] rescue {} end def platform RUBY_PLATFORM rescue '????' end def application_root CrashLog.configuration.root end def stage CrashLog.configuration.stage end end end end
Version data entries
4 entries across 4 versions & 1 rubygems