irb 1.13.1 → 1.13.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b57e45ef4cb7d58489abeda8131ed81a1625b05fd139e00082bf3011fc0c2fdc
4
- data.tar.gz: 411b92eee70de798e94c0c9c30801467cdf240a43eff4da9e46230374fa8504f
3
+ metadata.gz: 243737997cdd6abe7e129eb7e7945dca379f1af38ed4254dfe094f2a611918cc
4
+ data.tar.gz: 5a1cbbdf5ab88a61278afe32a5497f38efa1342e123734ae3ede6135aae9b91f
5
5
  SHA512:
6
- metadata.gz: '0919ac233b97abb80a9d34cad9be792e85bce261cc4c29c36eac8d7ba81bd99c4592b5b8c1bdbdc7e96d778ccf20b5374987eef0224e9fb6583639633e3c2bb0'
7
- data.tar.gz: 89dad0bbdebdee60a3f08ca2cf918293bffac4db7b183a45ab93f6cc4906ca7a62437286a08291ba76fae8e2bba31f3b6a28be3cd13a141f451a5c4e1b09041d
6
+ metadata.gz: 0b4e5d658e1eba4a0503ffd3776c3baffabb0782eb43a993aac593b6dc4383e9e209ca3c1f077c78225f612a1ac7607f951bc11a2ff8fd78a93e12029fbf1954
7
+ data.tar.gz: c9e978f318f22d322934b77b8c431830e67a9cb7cf365923041f77123ee5e7d39ffa814a4e7bdd9af759f4671d0b24bd2ae68a9d20beb54b4a0e4248e32ee85f
data/lib/irb/context.rb CHANGED
@@ -73,11 +73,12 @@ module IRB
73
73
 
74
74
  self.prompt_mode = IRB.conf[:PROMPT_MODE]
75
75
 
76
- if IRB.conf[:SINGLE_IRB] or !defined?(IRB::JobManager)
77
- @irb_name = IRB.conf[:IRB_NAME]
78
- else
79
- @irb_name = IRB.conf[:IRB_NAME]+"#"+IRB.JobManager.n_jobs.to_s
76
+ @irb_name = IRB.conf[:IRB_NAME]
77
+
78
+ unless IRB.conf[:SINGLE_IRB] or !defined?(IRB::JobManager)
79
+ @irb_name = @irb_name + "#" + IRB.JobManager.n_jobs.to_s
80
80
  end
81
+
81
82
  self.irb_path = "(" + @irb_name + ")"
82
83
 
83
84
  case input_method
@@ -2,32 +2,33 @@
2
2
 
3
3
  require_relative "command"
4
4
  require_relative "command/internal_helpers"
5
- require_relative "command/context"
6
- require_relative "command/exit"
7
- require_relative "command/force_exit"
8
- require_relative "command/chws"
9
- require_relative "command/pushws"
10
- require_relative "command/subirb"
11
- require_relative "command/load"
12
- require_relative "command/debug"
13
- require_relative "command/edit"
5
+ require_relative "command/backtrace"
14
6
  require_relative "command/break"
15
7
  require_relative "command/catch"
16
- require_relative "command/next"
17
- require_relative "command/delete"
18
- require_relative "command/step"
8
+ require_relative "command/chws"
9
+ require_relative "command/context"
19
10
  require_relative "command/continue"
11
+ require_relative "command/debug"
12
+ require_relative "command/delete"
13
+ require_relative "command/disable_irb"
14
+ require_relative "command/edit"
15
+ require_relative "command/exit"
20
16
  require_relative "command/finish"
21
- require_relative "command/backtrace"
22
- require_relative "command/info"
17
+ require_relative "command/force_exit"
23
18
  require_relative "command/help"
24
- require_relative "command/show_doc"
19
+ require_relative "command/history"
20
+ require_relative "command/info"
25
21
  require_relative "command/irb_info"
22
+ require_relative "command/load"
26
23
  require_relative "command/ls"
27
24
  require_relative "command/measure"
25
+ require_relative "command/next"
26
+ require_relative "command/pushws"
27
+ require_relative "command/show_doc"
28
28
  require_relative "command/show_source"
29
+ require_relative "command/step"
30
+ require_relative "command/subirb"
29
31
  require_relative "command/whereami"
30
- require_relative "command/history"
31
32
 
32
33
  module IRB
33
34
  module Command
@@ -235,6 +236,10 @@ module IRB
235
236
  [:history, NO_OVERRIDE],
236
237
  [:hist, NO_OVERRIDE]
237
238
  )
239
+
240
+ _register_with_aliases(:irb_disable_irb, Command::DisableIrb,
241
+ [:disable_irb, NO_OVERRIDE]
242
+ )
238
243
  end
239
244
 
240
245
  ExtendCommand = Command
data/lib/irb/init.rb CHANGED
@@ -52,6 +52,7 @@ module IRB # :nodoc:
52
52
  IRB.init_error
53
53
  IRB.parse_opts(argv: argv)
54
54
  IRB.run_config
55
+ IRB.validate_config
55
56
  IRB.load_modules
56
57
 
57
58
  unless @CONF[:PROMPT][@CONF[:PROMPT_MODE]]
@@ -427,6 +428,40 @@ module IRB # :nodoc:
427
428
  @irbrc_files
428
429
  end
429
430
 
431
+ def IRB.validate_config
432
+ conf[:IRB_NAME] = conf[:IRB_NAME].to_s
433
+
434
+ irb_rc = conf[:IRB_RC]
435
+ unless irb_rc.nil? || irb_rc.respond_to?(:call)
436
+ raise_validation_error "IRB.conf[:IRB_RC] should be a callable object. Got #{irb_rc.inspect}."
437
+ end
438
+
439
+ back_trace_limit = conf[:BACK_TRACE_LIMIT]
440
+ unless back_trace_limit.is_a?(Integer)
441
+ raise_validation_error "IRB.conf[:BACK_TRACE_LIMIT] should be an integer. Got #{back_trace_limit.inspect}."
442
+ end
443
+
444
+ prompt = conf[:PROMPT]
445
+ unless prompt.is_a?(Hash)
446
+ msg = "IRB.conf[:PROMPT] should be a Hash. Got #{prompt.inspect}."
447
+
448
+ if prompt.is_a?(Symbol)
449
+ msg += " Did you mean to set `IRB.conf[:PROMPT_MODE]`?"
450
+ end
451
+
452
+ raise_validation_error msg
453
+ end
454
+
455
+ eval_history = conf[:EVAL_HISTORY]
456
+ unless eval_history.nil? || eval_history.is_a?(Integer)
457
+ raise_validation_error "IRB.conf[:EVAL_HISTORY] should be an integer. Got #{eval_history.inspect}."
458
+ end
459
+ end
460
+
461
+ def IRB.raise_validation_error(msg)
462
+ raise TypeError, msg, @irbrc_files
463
+ end
464
+
430
465
  # loading modules
431
466
  def IRB.load_modules
432
467
  for m in @CONF[:LOAD_MODULES]
@@ -328,10 +328,11 @@ module IRB
328
328
  ->() {
329
329
  dialog.trap_key = nil
330
330
  alt_d = [
331
- [Reline::Key.new(nil, 0xE4, true)], # Normal Alt+d.
332
331
  [27, 100], # Normal Alt+d when convert-meta isn't used.
333
- [195, 164], # The "ä" that appears when Alt+d is pressed on xterm.
334
- [226, 136, 130] # The "∂" that appears when Alt+d in pressed on iTerm2.
332
+ # When option/alt is not configured as a meta key in terminal emulator,
333
+ # option/alt + d will send a unicode character depend on OS keyboard setting.
334
+ [195, 164], # "ä" in somewhere (FIXME: environment information is unknown).
335
+ [226, 136, 130] # "∂" Alt+d on Mac keyboard.
335
336
  ]
336
337
 
337
338
  if just_cursor_moving and completion_journey_data.nil?
data/lib/irb/ruby-lex.rb CHANGED
@@ -219,28 +219,7 @@ module IRB
219
219
  :unrecoverable_error
220
220
  rescue SyntaxError => e
221
221
  case e.message
222
- when /unterminated (?:string|regexp) meets end of file/
223
- # "unterminated regexp meets end of file"
224
- #
225
- # example:
226
- # /
227
- #
228
- # "unterminated string meets end of file"
229
- #
230
- # example:
231
- # '
232
- return :recoverable_error
233
- when /syntax error, unexpected end-of-input/
234
- # "syntax error, unexpected end-of-input, expecting keyword_end"
235
- #
236
- # example:
237
- # if true
238
- # hoge
239
- # if false
240
- # fuga
241
- # end
242
- return :recoverable_error
243
- when /syntax error, unexpected keyword_end/
222
+ when /unexpected keyword_end/
244
223
  # "syntax error, unexpected keyword_end"
245
224
  #
246
225
  # example:
@@ -250,7 +229,7 @@ module IRB
250
229
  # example:
251
230
  # end
252
231
  return :unrecoverable_error
253
- when /syntax error, unexpected '\.'/
232
+ when /unexpected '\.'/
254
233
  # "syntax error, unexpected '.'"
255
234
  #
256
235
  # example:
@@ -262,6 +241,27 @@ module IRB
262
241
  # example:
263
242
  # method / f /
264
243
  return :unrecoverable_error
244
+ when /unterminated (?:string|regexp) meets end of file/
245
+ # "unterminated regexp meets end of file"
246
+ #
247
+ # example:
248
+ # /
249
+ #
250
+ # "unterminated string meets end of file"
251
+ #
252
+ # example:
253
+ # '
254
+ return :recoverable_error
255
+ when /unexpected end-of-input/
256
+ # "syntax error, unexpected end-of-input, expecting keyword_end"
257
+ #
258
+ # example:
259
+ # if true
260
+ # hoge
261
+ # if false
262
+ # fuga
263
+ # end
264
+ return :recoverable_error
265
265
  else
266
266
  return :other_error
267
267
  end
data/lib/irb/version.rb CHANGED
@@ -5,7 +5,7 @@
5
5
  #
6
6
 
7
7
  module IRB # :nodoc:
8
- VERSION = "1.13.1"
8
+ VERSION = "1.13.2"
9
9
  @RELEASE_VERSION = VERSION
10
- @LAST_UPDATE_DATE = "2024-05-05"
10
+ @LAST_UPDATE_DATE = "2024-06-15"
11
11
  end
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.13.1
4
+ version: 1.13.2
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-05-05 00:00:00.000000000 Z
12
+ date: 2024-06-15 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: reline
@@ -157,7 +157,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
157
157
  - !ruby/object:Gem::Version
158
158
  version: '0'
159
159
  requirements: []
160
- rubygems_version: 3.5.7
160
+ rubygems_version: 3.5.11
161
161
  signing_key:
162
162
  specification_version: 4
163
163
  summary: Interactive Ruby command-line tool for REPL (Read Eval Print Loop).