2020-04-27 05:27:19 -04:00
|
|
|
# frozen_string_literal: false
|
|
|
|
|
|
|
|
require_relative "nop"
|
|
|
|
|
|
|
|
module IRB
|
2022-03-14 01:34:16 -04:00
|
|
|
# :stopdoc:
|
|
|
|
|
2020-04-27 05:27:19 -04:00
|
|
|
module ExtendCommand
|
|
|
|
class Info < Nop
|
|
|
|
def execute
|
|
|
|
Class.new {
|
|
|
|
def inspect
|
2020-04-28 04:06:43 -04:00
|
|
|
str = "Ruby version: #{RUBY_VERSION}\n"
|
|
|
|
str += "IRB version: #{IRB.version}\n"
|
|
|
|
str += "InputMethod: #{IRB.CurrentContext.io.inspect}\n"
|
|
|
|
str += ".irbrc path: #{IRB.rc_file}\n" if File.exist?(IRB.rc_file)
|
2021-02-09 03:29:38 -05:00
|
|
|
str += "RUBY_PLATFORM: #{RUBY_PLATFORM}\n"
|
2021-07-10 09:32:51 -04:00
|
|
|
str += "LANG env: #{ENV["LANG"]}\n" if ENV["LANG"] && !ENV["LANG"].empty?
|
|
|
|
str += "LC_ALL env: #{ENV["LC_ALL"]}\n" if ENV["LC_ALL"] && !ENV["LC_ALL"].empty?
|
2021-12-20 02:06:12 -05:00
|
|
|
str += "East Asian Ambiguous Width: #{Reline.ambiguous_width.inspect}\n"
|
2021-07-15 10:42:11 -04:00
|
|
|
if RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|cygwin|bccwin|wince|emc/
|
2021-12-23 11:54:09 -05:00
|
|
|
codepage = `chcp`.b.sub(/.*: (\d+)\n/, '\1')
|
2021-07-15 10:42:11 -04:00
|
|
|
str += "Code page: #{codepage}\n"
|
|
|
|
end
|
2020-04-28 04:06:43 -04:00
|
|
|
str
|
2020-04-27 05:27:19 -04:00
|
|
|
end
|
|
|
|
alias_method :to_s, :inspect
|
|
|
|
}.new
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
2022-03-14 01:34:16 -04:00
|
|
|
|
|
|
|
# :startdoc:
|
2020-04-27 05:27:19 -04:00
|
|
|
end
|