irb 1.14.0 → 1.14.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/Gemfile +1 -1
- data/README.md +8 -2
- data/lib/irb/command/base.rb +10 -8
- data/lib/irb/command/debug.rb +8 -6
- data/lib/irb/command/help.rb +1 -1
- data/lib/irb/context.rb +42 -13
- data/lib/irb/debug.rb +6 -10
- data/lib/irb/default_commands.rb +15 -7
- data/lib/irb/easter-egg.rb +8 -5
- data/lib/irb/input-method.rb +10 -17
- data/lib/irb/inspector.rb +31 -30
- data/lib/irb/nesting_parser.rb +196 -194
- data/lib/irb/pager.rb +5 -1
- data/lib/irb/ruby-lex.rb +84 -82
- data/lib/irb/ruby_logo.aa +75 -37
- data/lib/irb/source_finder.rb +1 -1
- data/lib/irb/version.rb +2 -2
- data/lib/irb/workspace.rb +7 -5
- data/lib/irb.rb +32 -57
- metadata +2 -2
data/lib/irb/ruby_logo.aa
CHANGED
@@ -1,41 +1,41 @@
|
|
1
|
-
TYPE:
|
1
|
+
TYPE: ASCII_LARGE
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
3
|
+
,,,;;;;;;;;;;;;;;;;;;;;;;,,
|
4
|
+
,,,;;;;;;;;;,, ,;;;' ''';;,
|
5
|
+
,,;;;''' ';;;, ,,;;'' '';,
|
6
|
+
,;;'' ;;;;;;;;,,,,,, ';;
|
7
|
+
,;;'' ;;;;';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,,,,,,,,,,, ';;;;;
|
36
|
+
';, ';,;;' ,,,;;'' '''''''';;;;;;;;;;;;;;;;;;;
|
37
|
+
';;,,, ;;;; ,,,,;;;;;;,,,,,;;;;;;;;;;;;;;;;;;;''''''''''''''
|
38
|
+
''';;;;;;;;;;;;;;'''''''''''''''
|
39
39
|
TYPE: ASCII
|
40
40
|
,,,;;;;''''';;;'';,
|
41
41
|
,,;'' ';;,;;; ',
|
@@ -57,6 +57,44 @@ TYPE: ASCII
|
|
57
57
|
;;; '; ;' ';,,'' ';,;;
|
58
58
|
'; ';,; ,,;''''''''';;;;;;,,;;;
|
59
59
|
';,,;;,,;;;;;;;;;;''''''''''''''
|
60
|
+
TYPE: UNICODE_LARGE
|
61
|
+
|
62
|
+
⣀⣤⣴⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣶⣤⣄⡀
|
63
|
+
⢀⣀⣤⣴⣾⣿⣿⣿⠿⣿⣿⣿⣿⣦⣀ ⢀⣤⣶⣿⠿⠛⠁⠈⠉⠙⠻⢿⣷⣦⡀
|
64
|
+
⢀⣠⣴⣾⡿⠿⠛⠉⠉ ⠈⠙⢿⣿⣷⣤⡀ ⣠⣴⣾⡿⠟⠉ ⠉⠻⣿⣦
|
65
|
+
⢀⣤⣶⣿⠟⠋⠁ ⢿⣿⣿⣿⣿⣿⣿⣧⣤⣤⣤⣀⣀⣀⡀ ⠘⢿⣷⡀
|
66
|
+
⢀⣠⣾⡿⠟⠉ ⢸⣿⣿⣿⠟⢿⣿⣯⡙⠛⠛⠛⠿⠿⠿⢿⣿⣿⣶⣶⣶⣦⣤⣬⣿⣧
|
67
|
+
⣠⣴⣿⠟⠋ ⢸⣿⣿⡿ ⠈⠻⣿⣶⣄ ⠉⠉⠉⠙⠛⢻⣿⡆
|
68
|
+
⣠⣾⡿⠛⠁ ⣼⣿⣿⠃ ⠈⠙⢿⣷⣤⡀ ⠈⣿⡇
|
69
|
+
⣠⣾⡿⠋ ⢠⣿⣿⡏ ⠙⠻⣿⣦⣀ ⣿⡇
|
70
|
+
⣠⣾⡿⠋ ⢀⣿⣿⣿ ⠈⠛⢿⣷⣄⡀ ⢠⣿⡇
|
71
|
+
⢀⣾⡿⠋ ⢀⣾⣿⣿⠇ ⠙⠻⣿⣦⣀ ⢸⣿⡇
|
72
|
+
⢀⣴⣿⠟⠁ ⢀⣾⣿⣿⡟ ⠈⠻⢿⣷⣄ ⣾⣿⠇
|
73
|
+
⢠⣾⡿⠃ ⣠⣿⣿⣿⣿⠃ ⣀⣀⣀⣀⣀⣀⣀⣀⣤⣤⣤⣤⣽⣿⣿⣿⣿
|
74
|
+
⣰⣿⠟ ⣴⣿⣿⣿⣿⣿⣶⣶⣿⣿⣿⣿⣿⠿⠿⠿⠿⠿⠿⠿⠿⠛⠛⠛⠛⠛⠛⠛⠛⣿⣿⣿
|
75
|
+
⣼⣿⠏ ⢠⣾⣿⣿⣿⡿⣿⣿⢿⣷⣦⣄ ⣼⣿⣿⣿
|
76
|
+
⣼⣿⠃ ⢀⣴⣿⣿⣿⠟⠋ ⢸⣿⡆⠈⠛⠿⣿⣦⣄⡀ ⣰⣿⣿⣿⡇
|
77
|
+
⢀⣾⣿⠃ ⢀⣴⣿⣿⣿⠟⠁ ⣿⣷ ⠈⠙⠻⣿⣶⣄⡀ ⣰⣿⠟⣿⣿⡇
|
78
|
+
⢀⣾⣿⠇ ⢀⣴⣿⣿⣿⠟⠁ ⢸⣿⡆ ⠙⠻⢿⣷⣤⣀ ⣰⣿⠏⢠⣿⣿⡇
|
79
|
+
⢠⣿⣿⡟ ⢀⣴⣿⣿⡿⠛⠁ ⣿⣷ ⠉⠻⢿⣷⣦⣀ ⣴⣿⠏ ⢸⣿⣿⠃
|
80
|
+
⣿⣿⣿⡇ ⣠⣴⣿⣿⡿⠋ ⢸⣿⡆ ⠈⠛⢿⣿⣿⠃ ⢸⣿⣿
|
81
|
+
⢠⣿⣿⣿ ⢀⣴⣾⣿⣿⡿⠋ ⠈⣿⣧ ⢠⣾⣿⣿ ⢸⣿⣿
|
82
|
+
⢸⣿⣿⣿⡇ ⣀⣴⣾⣿⣿⣿⡿⠋ ⢹⣿⡆ ⣴⣿⠟⢹⣿⡀ ⢸⣿⡿
|
83
|
+
⢸⣿⡟⣿⣿⣄ ⣀⣤⣶⣿⣿⣿⣿⣿⡟⠉ ⠈⣿⣷ ⢠⣾⡿⠋ ⢸⣿⡇ ⣼⣿⡇
|
84
|
+
⢸⣿⡇⢹⣿⣿⣷⣦⣤⣤⣤⣤⣤⣴⣶⣾⣿⣿⣿⣿⡿⠿⣿⣿⣿⣿⣷⣶⣤⣤⣀⡀ ⢹⣿⡆ ⢀⣴⣿⠟ ⣿⣧ ⣿⣿⡇
|
85
|
+
⢸⣿⠃ ⢿⣿⣿⣿⣿⣿⣿⡿⠿⠿⠛⠛⠉⠉⠁ ⢰⣿⠟⣿⣷⡀⠉⠙⠛⠿⢿⣿⣶⣦⣤⣀⡀ ⠈⣿⣷ ⣠⣿⡿⠁ ⢿⣿ ⣿⣿⡇
|
86
|
+
⢸⣿ ⢀⣾⣿⣿⠋⠉⠁ ⢀⣿⡿ ⠘⣿⣷⡀ ⠉⠙⠛⠿⠿⣿⣶⣦⣤⣄⣀ ⢹⣿⡄ ⣠⣾⡿⠋ ⢸⣿⡆ ⣿⣿
|
87
|
+
⣸⣿⢀⣾⣿⣿⣿⣆ ⣸⣿⠃ ⠘⢿⣷⡀ ⠈⠉⠛⠻⠿⣿⣷⣶⣤⣌⣿⣷⣾⡿⠋ ⠘⣿⡇ ⣿⣿
|
88
|
+
⣿⣿⣾⡿⣿⡿⠹⣿⡆ ⢠⣿⡏ ⠈⢿⣷⡀ ⠈⠉⠙⣻⣿⣿⣿⣀ ⣿⣷⢰⣿⣿
|
89
|
+
⣿⣿⡿⢁⣿⡇ ⢻⣿⡄ ⣾⣿ ⠈⢿⣷⡀ ⢀⣤⣾⡿⠋⠈⠻⢿⣷⣄ ⢻⣿⢸⣿⡟
|
90
|
+
⣿⣿⠁⢸⣿⡇ ⢻⣿⡄ ⢸⣿⠇ ⠈⢿⣷⡀ ⣀⣴⣿⠟⠋ ⠙⢿⣷⣤⡀ ⢸⣿⣿⣿⡇
|
91
|
+
⣿⣿ ⢸⣿⠁ ⠈⢿⣷⡀ ⢀⣿⡟ ⠈⢿⣷⡀ ⢀⣤⣾⡿⠛⠁ ⠙⠻⣿⣦⡀ ⠈⣿⣿⣿⡇
|
92
|
+
⢸⣿⡄⣿⣿ ⠈⣿⣷⡀ ⣼⣿⠃ ⠈⢿⣷⡀ ⢀⣠⣶⣿⠟⠋ ⠈⠻⣿⣦⣄ ⣿⣿⣿⠇
|
93
|
+
⠈⣿⣷⣿⡿ ⠘⣿⣧ ⢠⣿⡏ ⠈⢿⣷⣄⣤⣶⣿⠟⠋ ⠈⠛⢿⣷⣄ ⢸⣿⣿
|
94
|
+
⠘⣿⣿⡇ ⠘⣿⣧ ⣾⣿ ⢀⣠⣼⣿⣿⣿⣿⣿⣷⣶⣶⣶⣶⣶⣶⣤⣤⣤⣤⣤⣤⣀⣀⣀⣀⣀⣀⡀ ⠙⢿⣷⣼⣿⣿
|
95
|
+
⠈⠻⣿⣦⡀ ⠹⣿⣆⢸⣿⠇ ⣀⣠⣴⣾⡿⠟⠋⠁ ⠉⠉⠉⠉⠉⠉⠛⠛⣛⣛⣛⣻⣿⣿⣿⣿⣿⣿⣿⣿⣿⣿⣷⣿⣿⣿⡿
|
96
|
+
⠈⠻⢿⣷⣦⣄⣀⡀ ⢹⣿⣿⡟ ⢀⣀⣀⣤⣤⣶⣾⣿⣿⣿⣯⣥⣤⣤⣤⣤⣶⣶⣶⣶⣶⣶⣶⣾⣿⣿⣿⣿⠿⠿⠿⠿⠿⠿⠿⠟⠛⠛⠛⠛⠛⠛⠛⠉⠉⠉⠉⠉⠉
|
97
|
+
⠉⠙⠛⠿⠿⠿⣿⣿⣿⣿⠿⠿⠿⠿⠿⠿⠿⠛⠛⠛⠛⠛⠛⠛⠋⠉⠉⠉⠉⠉⠉⠉
|
60
98
|
TYPE: UNICODE
|
61
99
|
⣀⣤⣴⣾⣿⣿⣿⡛⠛⠛⠛⠛⣻⣿⠿⠛⠛⠶⣤⡀
|
62
100
|
⣀⣴⠾⠛⠉⠁ ⠙⣿⣶⣤⣶⣟⣉ ⠈⠻⣦
|
data/lib/irb/source_finder.rb
CHANGED
@@ -100,7 +100,7 @@ module IRB
|
|
100
100
|
Source.new(file, line)
|
101
101
|
elsif method
|
102
102
|
# Method defined with eval, probably in IRB session
|
103
|
-
source = RubyVM::
|
103
|
+
source = RubyVM::InstructionSequence.of(method)&.script_lines&.join rescue nil
|
104
104
|
Source.new(file, line, source)
|
105
105
|
end
|
106
106
|
rescue EvaluationError
|
data/lib/irb/version.rb
CHANGED
data/lib/irb/workspace.rb
CHANGED
@@ -176,11 +176,13 @@ EOF
|
|
176
176
|
end
|
177
177
|
|
178
178
|
module HelpersContainer
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
179
|
+
class << self
|
180
|
+
def install_helper_methods
|
181
|
+
HelperMethod.helper_methods.each do |name, helper_method_class|
|
182
|
+
define_method name do |*args, **opts, &block|
|
183
|
+
helper_method_class.instance.execute(*args, **opts, &block)
|
184
|
+
end unless method_defined?(name)
|
185
|
+
end
|
184
186
|
end
|
185
187
|
end
|
186
188
|
|
data/lib/irb.rb
CHANGED
@@ -880,40 +880,42 @@ module IRB
|
|
880
880
|
# An exception raised by IRB.irb_abort
|
881
881
|
class Abort < Exception;end
|
882
882
|
|
883
|
-
|
884
|
-
|
885
|
-
|
886
|
-
|
887
|
-
|
888
|
-
|
889
|
-
|
890
|
-
|
883
|
+
class << self
|
884
|
+
# The current IRB::Context of the session, see IRB.conf
|
885
|
+
#
|
886
|
+
# irb
|
887
|
+
# irb(main):001:0> IRB.CurrentContext.irb_name = "foo"
|
888
|
+
# foo(main):002:0> IRB.conf[:MAIN_CONTEXT].irb_name #=> "foo"
|
889
|
+
def CurrentContext # :nodoc:
|
890
|
+
conf[:MAIN_CONTEXT]
|
891
|
+
end
|
891
892
|
|
892
|
-
|
893
|
-
|
894
|
-
|
895
|
-
|
893
|
+
# Initializes IRB and creates a new Irb.irb object at the `TOPLEVEL_BINDING`
|
894
|
+
def start(ap_path = nil)
|
895
|
+
STDOUT.sync = true
|
896
|
+
$0 = File::basename(ap_path, ".rb") if ap_path
|
896
897
|
|
897
|
-
|
898
|
+
setup(ap_path)
|
898
899
|
|
899
|
-
|
900
|
-
|
901
|
-
|
902
|
-
|
900
|
+
if @CONF[:SCRIPT]
|
901
|
+
irb = Irb.new(nil, @CONF[:SCRIPT])
|
902
|
+
else
|
903
|
+
irb = Irb.new
|
904
|
+
end
|
905
|
+
irb.run(@CONF)
|
903
906
|
end
|
904
|
-
irb.run(@CONF)
|
905
|
-
end
|
906
907
|
|
907
|
-
|
908
|
-
|
909
|
-
|
910
|
-
|
908
|
+
# Quits irb
|
909
|
+
def irb_exit(*) # :nodoc:
|
910
|
+
throw :IRB_EXIT, false
|
911
|
+
end
|
911
912
|
|
912
|
-
|
913
|
-
|
914
|
-
|
915
|
-
|
916
|
-
|
913
|
+
# Aborts then interrupts irb.
|
914
|
+
#
|
915
|
+
# Will raise an Abort exception, or the given `exception`.
|
916
|
+
def irb_abort(irb, exception = Abort) # :nodoc:
|
917
|
+
irb.context.thread.raise exception, "abort then interrupt!"
|
918
|
+
end
|
917
919
|
end
|
918
920
|
|
919
921
|
class Irb
|
@@ -1129,7 +1131,7 @@ module IRB
|
|
1129
1131
|
end
|
1130
1132
|
|
1131
1133
|
code.force_encoding(@context.io.encoding)
|
1132
|
-
if (command, arg = parse_command(code))
|
1134
|
+
if (command, arg = @context.parse_command(code))
|
1133
1135
|
command_class = Command.load_command(command)
|
1134
1136
|
Statement::Command.new(code, command_class, arg)
|
1135
1137
|
else
|
@@ -1138,35 +1140,8 @@ module IRB
|
|
1138
1140
|
end
|
1139
1141
|
end
|
1140
1142
|
|
1141
|
-
ASSIGN_OPERATORS_REGEXP = Regexp.union(%w[= += -= *= /= %= **= &= |= &&= ||= ^= <<= >>=])
|
1142
|
-
|
1143
|
-
def parse_command(code)
|
1144
|
-
command_name, arg = code.strip.split(/\s+/, 2)
|
1145
|
-
return unless code.lines.size == 1 && command_name
|
1146
|
-
|
1147
|
-
arg ||= ''
|
1148
|
-
command = command_name.to_sym
|
1149
|
-
# Command aliases are always command. example: $, @
|
1150
|
-
if (alias_name = @context.command_aliases[command])
|
1151
|
-
return [alias_name, arg]
|
1152
|
-
end
|
1153
|
-
|
1154
|
-
# Assignment-like expression is not a command
|
1155
|
-
return if arg.start_with?(ASSIGN_OPERATORS_REGEXP) && !arg.start_with?(/==|=~/)
|
1156
|
-
|
1157
|
-
# Local variable have precedence over command
|
1158
|
-
return if @context.local_variables.include?(command)
|
1159
|
-
|
1160
|
-
# Check visibility
|
1161
|
-
public_method = !!Kernel.instance_method(:public_method).bind_call(@context.main, command) rescue false
|
1162
|
-
private_method = !public_method && !!Kernel.instance_method(:method).bind_call(@context.main, command) rescue false
|
1163
|
-
if Command.execute_as_command?(command, public_method: public_method, private_method: private_method)
|
1164
|
-
[command, arg]
|
1165
|
-
end
|
1166
|
-
end
|
1167
|
-
|
1168
1143
|
def command?(code)
|
1169
|
-
|
1144
|
+
!!@context.parse_command(code)
|
1170
1145
|
end
|
1171
1146
|
|
1172
1147
|
def configure_io
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: irb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.14.
|
4
|
+
version: 1.14.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- aycabta
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: exe
|
11
11
|
cert_chain: []
|
12
|
-
date: 2024-
|
12
|
+
date: 2024-09-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: reline
|