irb 1.15.3 → 1.16.0

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7c3e1957674939d29308f3f534aa65b0a85557c1b7cd47ca6709fef260486eba
4
- data.tar.gz: f60b6b8752639425dc0e8aec1443fdc88b82c9799e6c71edf4dd88945efbbd23
3
+ metadata.gz: 0ab1ed5aa7bab885e57c409b5267ae77c02dd4dfce34fe1099bf2407c0f78c82
4
+ data.tar.gz: 84b33ebb88359bc8eea1480f08f46b930e2e18e350121f9cf06934d3b51f631e
5
5
  SHA512:
6
- metadata.gz: fc15c91bd69233b5cbe962cec327c918805db5553c81c4ba450836d626ab56a3745fd04ca4e185470434bd1e69fe94bab9536bf3bf4704538bbf39681b2291ac
7
- data.tar.gz: 4b655b0a770eb2524757b8033e5796892dd43944ee7157dd7523f31d4fe6ffe6fed49ca281faa4990ba2c0dd014e662b1fc54445ee80ea5aa135cf097102d005
6
+ metadata.gz: 2ce74e4d4954c7606b2b74f5a7138e5c4e21690a819d63256c21ed2f6f05d077355ab59b9fa91407beec6e5db74d2b117b6dd434805aae53878041fd871c123f
7
+ data.tar.gz: d1fcf2223fdda3720fcc2c2d0e6d980e8b16a204ad6c31b503002e19047eb70b4f385b902de2dc6d6a5d7471a731371e8c99e86df1f02a3d975d639e74fda657
data/Gemfile CHANGED
@@ -20,7 +20,7 @@ gem "test-unit-ruby-core"
20
20
  gem "rubocop"
21
21
 
22
22
  gem "tracer" if !is_truffleruby
23
- gem "debug", github: "ruby/debug", platforms: [:mri, :mswin]
23
+ gem "debug", github: "ruby/debug"
24
24
 
25
25
  gem "rdoc", ">= 6.11.0"
26
26
 
@@ -21,7 +21,7 @@ These are the IRB command-line options, with links to explanatory text:
21
21
  - `--colorize`: Use {color-highlighting}[rdoc-ref:IRB@Color+Highlighting]
22
22
  for input and output.
23
23
  - `--context-mode _n_`: Select method to create Binding object
24
- for new {workspace}[rdoc-ref:IRB@Commands]; `n` in range `0..4`.
24
+ for new {workspace}[rdoc-ref:IRB@Commands]; `n` in range `0..5`.
25
25
  - `--echo`: Print ({echo}[rdoc-ref:IRB@Return-Value+Printing+-28Echoing-29])
26
26
  return values.
27
27
  - `--extra-doc-dir _dirpath_`:
@@ -16,11 +16,10 @@ IRB searches for a configuration file in the following order:
16
16
  1. `$IRBRC`
17
17
  2. `$XDG_CONFIG_HOME/irb/irbrc`
18
18
  3. `$HOME/.irbrc`
19
- 4. `$HOME/.config/irb/irbrc`
19
+ 4. `$HOME/.config/irb/irbrc` (only if `XDG_CONFIG_HOME` is _not_ set)
20
20
  5. `.irbrc` in the current directory
21
- 6. `irb.rc` in the current directory
22
- 7. `_irbrc` in the current directory
23
- 8. `$irbrc` in the current directory
21
+ 6. `_irbrc` in the current directory
22
+ 7. `$irbrc` in the current directory
24
23
 
25
24
  If the `-f` command-line option is used, no configuration file is loaded.
26
25
 
@@ -34,7 +33,7 @@ Method `conf.rc?` returns `true` if a configuration file was read, `false` other
34
33
  - `IRB_COPY_COMMAND`: Overrides the default program used to interface with the system clipboard.
35
34
  - `VISUAL` / `EDITOR`: Specifies the editor for the `edit` command.
36
35
  - `IRBRC`: Specifies the rc-file for configuration.
37
- - `XDG_CONFIG_HOME`: Used to locate the rc-file if `IRBRC` is unset.
36
+ - `XDG_CONFIG_HOME`: Used to locate the user-specific rc-file (i.e. `$XDG_CONFIG_HOME/irb/irbrc` instead of `$HOME/.config/irb/irbrc`).
38
37
  - `RI_PAGER` / `PAGER`: Specifies the pager for documentation.
39
38
  - `IRB_LANG`, `LC_MESSAGES`, `LC_ALL`, `LANG`: Determines the locale.
40
39
 
data/doc/irb/irb.rd.ja CHANGED
@@ -48,7 +48,7 @@ irbの使い方は, Rubyさえ知っていればいたって簡単です. 基本
48
48
  -w ruby -w と同じ.
49
49
  -W[level=2] ruby -W と同じ.
50
50
  --context-mode n 新しいワークスペースを作成した時に関連する Binding
51
- オブジェクトの作成方法を 0 から 3 のいずれかに設定する.
51
+ オブジェクトの作成方法を 0 から 5 のいずれかに設定する.
52
52
  --echo 実行結果を表示する(デフォルト).
53
53
  --noecho 実行結果を表示しない.
54
54
  --echo-on-assignment
data/lib/irb/context.rb CHANGED
@@ -632,14 +632,15 @@ module IRB
632
632
  command_class = Command.load_command(command)
633
633
  end
634
634
 
635
- # Check visibility
636
- public_method = !!KERNEL_PUBLIC_METHOD.bind_call(main, command) rescue false
637
- private_method = !public_method && !!KERNEL_METHOD.bind_call(main, command) rescue false
638
- if command_class && Command.execute_as_command?(command, public_method: public_method, private_method: private_method)
639
- Statement::Command.new(code, command_class, arg)
640
- else
641
- Statement::Expression.new(code, is_assignment_expression)
635
+ if command_class
636
+ # Check whether the command conflicts with existing methods
637
+ public_method = !!KERNEL_PUBLIC_METHOD.bind_call(main, command) rescue false
638
+ private_method = !public_method && !!KERNEL_METHOD.bind_call(main, command) rescue false
639
+ if Command.execute_as_command?(command, public_method: public_method, private_method: private_method)
640
+ return Statement::Command.new(code, command_class, arg)
641
+ end
642
642
  end
643
+ Statement::Expression.new(code, is_assignment_expression)
643
644
  end
644
645
 
645
646
  def colorize_input(input, complete:)
@@ -65,6 +65,7 @@ module IRB
65
65
  @current_job = irb
66
66
  th.run
67
67
  Thread.stop
68
+ Thread.pass
68
69
  @current_job = irb(Thread.current)
69
70
  end
70
71
 
@@ -220,6 +221,7 @@ module IRB
220
221
  end
221
222
  end
222
223
  Thread.stop
224
+ Thread.pass
223
225
  @JobManager.current_job = @JobManager.irb(Thread.current)
224
226
  end
225
227
 
@@ -6,10 +6,10 @@ Usage: irb.rb [options] [programfile] [arguments]
6
6
  -U Set external and internal encodings to UTF-8.
7
7
  -E ex[:in] Set default external (ex) and internal (in) encodings
8
8
  (same as 'ruby -E').
9
- -w Suppress warnings (same as 'ruby -w').
9
+ -w Enable warnings (same as 'ruby -w' or 'ruby -W1').
10
10
  -W[level=2] Set warning level: 0=silence, 1=medium, 2=verbose
11
11
  (same as 'ruby -W').
12
- --context-mode n Set n[0-4] to method to create Binding Object,
12
+ --context-mode n Set n[0-5] to method to create Binding Object,
13
13
  when new workspace was created.
14
14
  --extra-doc-dir Add an extra doc dir for the doc dialog.
15
15
  --echo Show result (default).
@@ -8,7 +8,7 @@ Usage: irb.rb [options] [programfile] [arguments]
8
8
  -w ruby -w と同じ.
9
9
  -W[level=2] ruby -W と同じ.
10
10
  --context-mode n 新しいワークスペースを作成した時に関連する Binding
11
- オブジェクトの作成方法を 0 から 4 のいずれかに設定する.
11
+ オブジェクトの作成方法を 0 から 5 のいずれかに設定する.
12
12
  --extra-doc-dir 指定したディレクトリのドキュメントを追加で読み込む.
13
13
  --echo 実行結果を表示する(デフォルト).
14
14
  --noecho 実行結果を表示しない.
@@ -29,10 +29,13 @@ module IRB
29
29
 
30
30
  def colorized_content
31
31
  if !binary_file? && file_exist?
32
- end_line = find_end
33
32
  # To correctly colorize, we need to colorize full content and extract the relevant lines.
34
- colored = IRB::Color.colorize_code(file_content)
35
- colored.lines[@line - 1...end_line].join
33
+ colored_lines = IRB::Color.colorize_code(file_content).lines
34
+
35
+ # Handle wrong line number case: line_no passed to eval is wrong, file is edited after load, etc
36
+ return if colored_lines.size < @line
37
+
38
+ colored_lines[@line - 1...find_end].join
36
39
  elsif @ast_source
37
40
  IRB::Color.colorize_code(@ast_source)
38
41
  end
data/lib/irb/version.rb CHANGED
@@ -5,7 +5,7 @@
5
5
  #
6
6
 
7
7
  module IRB # :nodoc:
8
- VERSION = "1.15.3"
8
+ VERSION = "1.16.0"
9
9
  @RELEASE_VERSION = VERSION
10
- @LAST_UPDATE_DATE = "2025-11-01"
10
+ @LAST_UPDATE_DATE = "2025-12-17"
11
11
  end
data/lib/irb/workspace.rb CHANGED
@@ -55,6 +55,15 @@ EOF
55
55
  # Note that this will typically be IRB::TOPLEVEL_BINDING
56
56
  # This is to avoid RubyGems' local variables (see issue #17623)
57
57
  @binding = TOPLEVEL_BINDING.dup
58
+
59
+ when 5 # binding in Ruby::Box
60
+ unless defined?(Ruby::Box)
61
+ puts 'Context-mode 5 (binding in Ruby::Box) requires Ruby 4.0 or later.'
62
+ raise NameError, 'Ruby::Box not defined'
63
+ end
64
+
65
+ puts 'Context-mode 5 (binding in Ruby::Box) is experimental. It may be removed or changed without notice.'
66
+ @binding = Ruby::Box.new.eval('Kernel.binding')
58
67
  end
59
68
  end
60
69
 
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.15.3
4
+ version: 1.16.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - aycabta