irb 1.6.2 → 1.6.4
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 +13 -10
- data/README.md +56 -16
- data/exe/irb +0 -2
- data/irb.gemspec +6 -1
- data/lib/irb/cmd/chws.rb +0 -6
- data/lib/irb/cmd/fork.rb +0 -6
- data/lib/irb/cmd/help.rb +0 -6
- data/lib/irb/cmd/load.rb +0 -6
- data/lib/irb/cmd/ls.rb +20 -7
- data/lib/irb/cmd/nop.rb +6 -20
- data/lib/irb/cmd/pushws.rb +0 -6
- data/lib/irb/cmd/show_source.rb +4 -4
- data/lib/irb/cmd/subirb.rb +1 -6
- data/lib/irb/color.rb +4 -10
- data/lib/irb/color_printer.rb +6 -1
- data/lib/irb/completion.rb +9 -48
- data/lib/irb/context.rb +2 -7
- data/lib/irb/ext/change-ws.rb +0 -6
- data/lib/irb/ext/history.rb +2 -8
- data/lib/irb/ext/loader.rb +1 -31
- data/lib/irb/ext/multi-irb.rb +0 -6
- data/lib/irb/ext/save-history.rb +1 -6
- data/lib/irb/ext/tracer.rb +3 -9
- data/lib/irb/ext/use-loader.rb +0 -6
- data/lib/irb/ext/workspaces.rb +0 -6
- data/lib/irb/extend-command.rb +8 -89
- data/lib/irb/frame.rb +0 -6
- data/lib/irb/help.rb +0 -6
- data/lib/irb/init.rb +1 -9
- data/lib/irb/input-method.rb +1 -6
- data/lib/irb/inspector.rb +12 -10
- data/lib/irb/lc/error.rb +0 -6
- data/lib/irb/lc/help-message +2 -2
- data/lib/irb/lc/ja/error.rb +1 -7
- data/lib/irb/locale.rb +1 -6
- data/lib/irb/notifier.rb +0 -6
- data/lib/irb/output-method.rb +0 -6
- data/lib/irb/ruby-lex.rb +45 -64
- data/lib/irb/version.rb +2 -8
- data/lib/irb/workspace.rb +4 -15
- data/lib/irb/ws-for-case-2.rb +0 -6
- data/lib/irb/xmp.rb +0 -6
- data/lib/irb.rb +20 -23
- metadata +9 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db51125adbe98b16228e314bff627b1cec953b92f32c774c4b9a820dc3bfc40b
|
4
|
+
data.tar.gz: ead3ebf30f5a4369d8cc2767691397d766bab8532031f8f505c2d0b3f251e071
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d2f749ce66ed43433fbbc7ec8682a0c3f0180ac8fb676739e5c3cbf0eb2f8bbb89a7896af11120bdeedd730e57edddaeabf932ae22ac55ad33c99f8408ffc832
|
7
|
+
data.tar.gz: 55621e3a5f9926c3f1b44426c23b9b08543920075fa0d32eeda8b7db35ded09aba6c311011e7f8397a6a5089bbb63d2b2e2603c1d7e254b77a16b93ca35b76f3
|
data/Gemfile
CHANGED
@@ -2,14 +2,17 @@ source "https://rubygems.org"
|
|
2
2
|
|
3
3
|
gemspec
|
4
4
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
gem "
|
10
|
-
gem "
|
11
|
-
gem "stackprof" if is_unix && !is_truffleruby
|
12
|
-
gem "test-unit"
|
13
|
-
gem "reline", github: "ruby/reline" if ENV["WITH_LATEST_RELINE"] == "true"
|
14
|
-
gem "debug", github: "ruby/debug"
|
5
|
+
is_unix = RUBY_PLATFORM =~ /(aix|darwin|linux|(net|free|open)bsd|cygwin|solaris|irix|hpux)/i
|
6
|
+
is_truffleruby = RUBY_DESCRIPTION =~ /truffleruby/
|
7
|
+
|
8
|
+
if is_unix && ENV['WITH_VTERM']
|
9
|
+
gem "vterm", github: "ruby/vterm-gem"
|
10
|
+
gem "yamatanooroti", github: "ruby/yamatanooroti"
|
15
11
|
end
|
12
|
+
|
13
|
+
gem "stackprof" if is_unix && !is_truffleruby
|
14
|
+
|
15
|
+
gem "reline", github: "ruby/reline" if ENV["WITH_LATEST_RELINE"] == "true"
|
16
|
+
gem "rake"
|
17
|
+
gem "test-unit"
|
18
|
+
gem "debug", github: "ruby/debug"
|
data/README.md
CHANGED
@@ -1,12 +1,21 @@
|
|
1
1
|
# IRB
|
2
2
|
|
3
|
+
[](https://badge.fury.io/rb/irb)
|
4
|
+
[](https://github.com/ruby/irb/actions/workflows/test.yml)
|
5
|
+
|
3
6
|
IRB stands for "interactive Ruby" and is a tool to interactively execute Ruby expressions read from the standard input.
|
4
7
|
|
5
8
|
The `irb` command from your shell will start the interpreter.
|
6
9
|
|
7
10
|
## Installation
|
8
11
|
|
9
|
-
|
12
|
+
> **Note**
|
13
|
+
>
|
14
|
+
> IRB is a default gem of Ruby so you shouldn't need to install it separately.
|
15
|
+
>
|
16
|
+
> But if you're using Ruby 2.6 or later and want to upgrade/install a specific version of IRB, please follow these steps.
|
17
|
+
|
18
|
+
To install it with `bundler`, add this line to your application's Gemfile:
|
10
19
|
|
11
20
|
```ruby
|
12
21
|
gem 'irb'
|
@@ -14,31 +23,62 @@ gem 'irb'
|
|
14
23
|
|
15
24
|
And then execute:
|
16
25
|
|
17
|
-
|
26
|
+
```shell
|
27
|
+
$ bundle
|
28
|
+
```
|
18
29
|
|
19
|
-
Or install it
|
30
|
+
Or install it directly with:
|
20
31
|
|
21
|
-
|
32
|
+
```shell
|
33
|
+
$ gem install irb
|
34
|
+
```
|
22
35
|
|
23
36
|
## Usage
|
24
37
|
|
25
|
-
|
38
|
+
### The `irb` Executable
|
26
39
|
|
27
|
-
|
40
|
+
You can start a fresh IRB session by typing `irb` in your terminal.
|
28
41
|
|
29
|
-
|
42
|
+
In the session, you can evaluate Ruby expressions or even prototype a small Ruby script. An input is executed when it is syntactically complete.
|
43
|
+
|
44
|
+
```shell
|
30
45
|
$ irb
|
31
|
-
irb(main):001:0> 1+2
|
32
|
-
|
33
|
-
irb(main):002:
|
34
|
-
irb(main):003:
|
35
|
-
irb(main):004:2
|
36
|
-
irb(main):005:
|
37
|
-
irb(main):006:
|
38
|
-
|
46
|
+
irb(main):001:0> 1 + 2
|
47
|
+
=> 3
|
48
|
+
irb(main):002:1* class Foo
|
49
|
+
irb(main):003:2* def foo
|
50
|
+
irb(main):004:2* puts 1
|
51
|
+
irb(main):005:1* end
|
52
|
+
irb(main):006:0> end
|
53
|
+
=> :foo
|
54
|
+
irb(main):007:0> Foo.new.foo
|
55
|
+
1
|
56
|
+
=> nil
|
39
57
|
```
|
40
58
|
|
41
|
-
The
|
59
|
+
### The `binding.irb` Breakpoint
|
60
|
+
|
61
|
+
If you use Ruby 2.5 or later versions, you can also use `binding.irb` in your program as breakpoints.
|
62
|
+
|
63
|
+
Once a `binding.irb` is evaluated, a new IRB session will be started with the surrounding context:
|
64
|
+
|
65
|
+
```shell
|
66
|
+
$ ruby test.rb
|
67
|
+
|
68
|
+
From: test.rb @ line 2 :
|
69
|
+
|
70
|
+
1: def greet(word)
|
71
|
+
=> 2: binding.irb
|
72
|
+
3: puts "Hello #{word}"
|
73
|
+
4: end
|
74
|
+
5:
|
75
|
+
6: greet("World")
|
76
|
+
|
77
|
+
irb(main):001:0> word
|
78
|
+
=> "World"
|
79
|
+
irb(main):002:0> exit
|
80
|
+
Hello World
|
81
|
+
```
|
42
82
|
|
43
83
|
## Commands
|
44
84
|
|
data/exe/irb
CHANGED
data/irb.gemspec
CHANGED
@@ -16,6 +16,11 @@ Gem::Specification.new do |spec|
|
|
16
16
|
spec.homepage = "https://github.com/ruby/irb"
|
17
17
|
spec.licenses = ["Ruby", "BSD-2-Clause"]
|
18
18
|
|
19
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
20
|
+
spec.metadata["source_code_uri"] = spec.homepage
|
21
|
+
spec.metadata["documentation_uri"] = spec.homepage
|
22
|
+
spec.metadata["changelog_uri"] = "#{spec.homepage}/releases"
|
23
|
+
|
19
24
|
spec.files = [
|
20
25
|
".document",
|
21
26
|
"Gemfile",
|
@@ -34,7 +39,7 @@ Gem::Specification.new do |spec|
|
|
34
39
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
35
40
|
spec.require_paths = ["lib"]
|
36
41
|
|
37
|
-
spec.required_ruby_version = Gem::Requirement.new(">= 2.
|
42
|
+
spec.required_ruby_version = Gem::Requirement.new(">= 2.7")
|
38
43
|
|
39
44
|
spec.add_dependency "reline", ">= 0.3.0"
|
40
45
|
end
|
data/lib/irb/cmd/chws.rb
CHANGED
data/lib/irb/cmd/fork.rb
CHANGED
data/lib/irb/cmd/help.rb
CHANGED
data/lib/irb/cmd/load.rb
CHANGED
data/lib/irb/cmd/ls.rb
CHANGED
@@ -38,21 +38,34 @@ module IRB
|
|
38
38
|
|
39
39
|
def dump_methods(o, klass, obj)
|
40
40
|
singleton_class = begin obj.singleton_class; rescue TypeError; nil end
|
41
|
-
|
41
|
+
dumped_mods = Array.new
|
42
|
+
# singleton_class' ancestors should be at the front
|
43
|
+
maps = class_method_map(singleton_class&.ancestors || [], dumped_mods) + class_method_map(klass.ancestors, dumped_mods)
|
42
44
|
maps.each do |mod, methods|
|
43
45
|
name = mod == singleton_class ? "#{klass}.methods" : "#{mod}#methods"
|
44
46
|
o.dump(name, methods)
|
45
47
|
end
|
46
48
|
end
|
47
49
|
|
48
|
-
def class_method_map(classes)
|
49
|
-
|
50
|
-
classes.reject { |mod| mod >= Object }
|
51
|
-
|
52
|
-
|
50
|
+
def class_method_map(classes, dumped_mods)
|
51
|
+
dumped_methods = Array.new
|
52
|
+
classes = classes.reject { |mod| mod >= Object }
|
53
|
+
classes.map do |mod|
|
54
|
+
next if dumped_mods.include? mod
|
55
|
+
|
56
|
+
dumped_mods << mod
|
57
|
+
|
58
|
+
methods = mod.public_instance_methods(false).select do |method|
|
59
|
+
if dumped_methods.include? method
|
60
|
+
false
|
61
|
+
else
|
62
|
+
dumped_methods << method
|
63
|
+
true
|
64
|
+
end
|
53
65
|
end
|
66
|
+
|
54
67
|
[mod, methods]
|
55
|
-
end.
|
68
|
+
end.compact
|
56
69
|
end
|
57
70
|
|
58
71
|
class Output
|
data/lib/irb/cmd/nop.rb
CHANGED
@@ -1,14 +1,9 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
#
|
3
3
|
# nop.rb -
|
4
|
-
# $Release Version: 0.9.6$
|
5
|
-
# $Revision$
|
6
4
|
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
7
5
|
#
|
8
|
-
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
6
|
+
|
12
7
|
module IRB
|
13
8
|
# :stopdoc:
|
14
9
|
|
@@ -35,20 +30,11 @@ module IRB
|
|
35
30
|
end
|
36
31
|
end
|
37
32
|
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
puts e.message
|
44
|
-
end
|
45
|
-
else
|
46
|
-
def self.execute(conf, *opts, &block)
|
47
|
-
command = new(conf)
|
48
|
-
command.execute(*opts, &block)
|
49
|
-
rescue CommandArgumentError => e
|
50
|
-
puts e.message
|
51
|
-
end
|
33
|
+
def self.execute(conf, *opts, **kwargs, &block)
|
34
|
+
command = new(conf)
|
35
|
+
command.execute(*opts, **kwargs, &block)
|
36
|
+
rescue CommandArgumentError => e
|
37
|
+
puts e.message
|
52
38
|
end
|
53
39
|
|
54
40
|
def initialize(conf)
|
data/lib/irb/cmd/pushws.rb
CHANGED
data/lib/irb/cmd/show_source.rb
CHANGED
@@ -27,7 +27,7 @@ module IRB
|
|
27
27
|
when /\A[A-Z]\w*(::[A-Z]\w*)*\z/ # Const::Name
|
28
28
|
eval(str, irb_context.workspace.binding) # trigger autoload
|
29
29
|
base = irb_context.workspace.binding.receiver.yield_self { |r| r.is_a?(Module) ? r : Object }
|
30
|
-
file, line = base.const_source_location(str)
|
30
|
+
file, line = base.const_source_location(str)
|
31
31
|
when /\A(?<owner>[A-Z]\w*(::[A-Z]\w*)*)#(?<method>[^ :.]+)\z/ # Class#method
|
32
32
|
owner = eval(Regexp.last_match[:owner], irb_context.workspace.binding)
|
33
33
|
method = Regexp.last_match[:method]
|
@@ -40,15 +40,15 @@ module IRB
|
|
40
40
|
file, line = receiver.method(method).source_location if receiver.respond_to?(method)
|
41
41
|
end
|
42
42
|
if file && line
|
43
|
-
Source.new(file: file, first_line: line, last_line: find_end(file, line))
|
43
|
+
Source.new(file: file, first_line: line, last_line: find_end(file, line, irb_context))
|
44
44
|
end
|
45
45
|
end
|
46
46
|
|
47
47
|
private
|
48
48
|
|
49
|
-
def find_end(file, first_line)
|
49
|
+
def find_end(file, first_line, irb_context)
|
50
50
|
return first_line unless File.exist?(file)
|
51
|
-
lex = RubyLex.new
|
51
|
+
lex = RubyLex.new(irb_context)
|
52
52
|
lines = File.read(file).lines[(first_line - 1)..-1]
|
53
53
|
tokens = RubyLex.ripper_lex_without_warning(lines.join)
|
54
54
|
prev_tokens = []
|
data/lib/irb/cmd/subirb.rb
CHANGED
data/lib/irb/color.rb
CHANGED
@@ -197,15 +197,9 @@ module IRB # :nodoc:
|
|
197
197
|
end
|
198
198
|
end
|
199
199
|
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
on_scan.call(elem)
|
204
|
-
end
|
205
|
-
else
|
206
|
-
lexer.parse.sort_by(&:pos).each do |elem|
|
207
|
-
on_scan.call(elem)
|
208
|
-
end
|
200
|
+
lexer.scan.each do |elem|
|
201
|
+
next if allow_last_error and /meets end of file|unexpected end-of-input/ =~ elem.message
|
202
|
+
on_scan.call(elem)
|
209
203
|
end
|
210
204
|
# yield uncolorable DATA section
|
211
205
|
yield(nil, inner_code.byteslice(byte_pos...inner_code.bytesize), nil) if byte_pos < inner_code.bytesize
|
@@ -242,7 +236,7 @@ module IRB # :nodoc:
|
|
242
236
|
case token
|
243
237
|
when :on_symbeg, :on_symbols_beg, :on_qsymbols_beg
|
244
238
|
@stack << true
|
245
|
-
when :on_ident, :on_op, :on_const, :on_ivar, :on_cvar, :on_gvar, :on_kw
|
239
|
+
when :on_ident, :on_op, :on_const, :on_ivar, :on_cvar, :on_gvar, :on_kw, :on_backtick
|
246
240
|
if @stack.last # Pop only when it's Symbol
|
247
241
|
@stack.pop
|
248
242
|
return prev_state
|
data/lib/irb/color_printer.rb
CHANGED
@@ -4,6 +4,9 @@ require_relative 'color'
|
|
4
4
|
|
5
5
|
module IRB
|
6
6
|
class ColorPrinter < ::PP
|
7
|
+
METHOD_RESPOND_TO = Object.instance_method(:respond_to?)
|
8
|
+
METHOD_INSPECT = Object.instance_method(:inspect)
|
9
|
+
|
7
10
|
class << self
|
8
11
|
def pp(obj, out = $>, width = screen_width)
|
9
12
|
q = ColorPrinter.new(out, width)
|
@@ -22,9 +25,11 @@ module IRB
|
|
22
25
|
end
|
23
26
|
|
24
27
|
def pp(obj)
|
25
|
-
if obj
|
28
|
+
if String === obj
|
26
29
|
# Avoid calling Ruby 2.4+ String#pretty_print that splits a string by "\n"
|
27
30
|
text(obj.inspect)
|
31
|
+
elsif !METHOD_RESPOND_TO.bind(obj).call(:inspect)
|
32
|
+
text(METHOD_INSPECT.bind(obj).call)
|
28
33
|
else
|
29
34
|
super
|
30
35
|
end
|
data/lib/irb/completion.rb
CHANGED
@@ -1,8 +1,6 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
#
|
3
3
|
# irb/completion.rb -
|
4
|
-
# $Release Version: 0.9$
|
5
|
-
# $Revision$
|
6
4
|
# by Keiju ISHITSUKA(keiju@ishitsuka.com)
|
7
5
|
# From Original Idea of shugo@ruby-lang.org
|
8
6
|
#
|
@@ -60,19 +58,11 @@ module IRB
|
|
60
58
|
|
61
59
|
BASIC_WORD_BREAK_CHARACTERS = " \t\n`><=;|&{("
|
62
60
|
|
63
|
-
def self.absolute_path?(p) # TODO Remove this method after 2.6 EOL.
|
64
|
-
if File.respond_to?(:absolute_path?)
|
65
|
-
File.absolute_path?(p)
|
66
|
-
else
|
67
|
-
File.absolute_path(p) == p
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
61
|
GEM_PATHS =
|
72
62
|
if defined?(Gem::Specification)
|
73
63
|
Gem::Specification.latest_specs(true).map { |s|
|
74
64
|
s.require_paths.map { |p|
|
75
|
-
if absolute_path?(p)
|
65
|
+
if File.absolute_path?(p)
|
76
66
|
p
|
77
67
|
else
|
78
68
|
File.join(s.full_gem_path, p)
|
@@ -168,10 +158,12 @@ module IRB
|
|
168
158
|
|
169
159
|
def self.retrieve_completion_data(input, bind: IRB.conf[:MAIN_CONTEXT].workspace.binding, doc_namespace: false)
|
170
160
|
case input
|
171
|
-
|
161
|
+
# this regexp only matches the closing character because of irb's Reline.completer_quote_characters setting
|
162
|
+
# details are described in: https://github.com/ruby/irb/pull/523
|
163
|
+
when /^(.*["'`])\.([^.]*)$/
|
172
164
|
# String
|
173
165
|
receiver = $1
|
174
|
-
message = $
|
166
|
+
message = $2
|
175
167
|
|
176
168
|
if doc_namespace
|
177
169
|
"String.#{message}"
|
@@ -180,7 +172,9 @@ module IRB
|
|
180
172
|
select_message(receiver, message, candidates)
|
181
173
|
end
|
182
174
|
|
183
|
-
|
175
|
+
# this regexp only matches the closing character because of irb's Reline.completer_quote_characters setting
|
176
|
+
# details are described in: https://github.com/ruby/irb/pull/523
|
177
|
+
when /^(.*\/)\.([^.]*)$/
|
184
178
|
# Regexp
|
185
179
|
receiver = $1
|
186
180
|
message = $2
|
@@ -217,7 +211,7 @@ module IRB
|
|
217
211
|
select_message(receiver, message, proc_candidates | hash_candidates)
|
218
212
|
end
|
219
213
|
|
220
|
-
when /^(:[^:.]
|
214
|
+
when /^(:[^:.]+)$/
|
221
215
|
# Symbol
|
222
216
|
if doc_namespace
|
223
217
|
nil
|
@@ -358,14 +352,6 @@ module IRB
|
|
358
352
|
else
|
359
353
|
# func1.func2
|
360
354
|
candidates = []
|
361
|
-
to_ignore = ignored_modules
|
362
|
-
ObjectSpace.each_object(Module){|m|
|
363
|
-
next if (to_ignore.include?(m) rescue true)
|
364
|
-
next unless m.respond_to?(:instance_methods) # JRuby has modules that represent java packages. They don't include many common ruby methods
|
365
|
-
candidates.concat m.instance_methods(false).collect{|x| x.to_s}
|
366
|
-
}
|
367
|
-
candidates.sort!
|
368
|
-
candidates.uniq!
|
369
355
|
end
|
370
356
|
|
371
357
|
if doc_namespace
|
@@ -456,30 +442,5 @@ module IRB
|
|
456
442
|
end
|
457
443
|
end
|
458
444
|
end
|
459
|
-
|
460
|
-
def self.ignored_modules
|
461
|
-
# We could cache the result, but this is very fast already.
|
462
|
-
# By using this approach, we avoid Module#name calls, which are
|
463
|
-
# relatively slow when there are a lot of anonymous modules defined.
|
464
|
-
s = {}
|
465
|
-
|
466
|
-
scanner = lambda do |m|
|
467
|
-
next if s.include?(m) # IRB::ExtendCommandBundle::EXCB recurses.
|
468
|
-
s[m] = true
|
469
|
-
m.constants(false).each do |c|
|
470
|
-
value = m.const_get(c)
|
471
|
-
scanner.call(value) if value.is_a?(Module)
|
472
|
-
end
|
473
|
-
end
|
474
|
-
|
475
|
-
%i(IRB RubyLex).each do |sym|
|
476
|
-
next unless Object.const_defined?(sym)
|
477
|
-
scanner.call(Object.const_get(sym))
|
478
|
-
end
|
479
|
-
|
480
|
-
s.delete(IRB::Context) if defined?(IRB::Context)
|
481
|
-
|
482
|
-
s
|
483
|
-
end
|
484
445
|
end
|
485
446
|
end
|
data/lib/irb/context.rb
CHANGED
@@ -1,14 +1,9 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
#
|
3
3
|
# irb/context.rb - irb context
|
4
|
-
# $Release Version: 0.9.6$
|
5
|
-
# $Revision$
|
6
4
|
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
7
5
|
#
|
8
|
-
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
6
|
+
|
12
7
|
require_relative "workspace"
|
13
8
|
require_relative "inspector"
|
14
9
|
require_relative "input-method"
|
@@ -499,7 +494,7 @@ module IRB
|
|
499
494
|
line = "#{command} #{command_class.transform_args(args)}"
|
500
495
|
end
|
501
496
|
|
502
|
-
set_last_value(@workspace.evaluate(
|
497
|
+
set_last_value(@workspace.evaluate(line, irb_path, line_no))
|
503
498
|
end
|
504
499
|
|
505
500
|
def inspect_last_value # :nodoc:
|
data/lib/irb/ext/change-ws.rb
CHANGED
data/lib/irb/ext/history.rb
CHANGED
@@ -1,14 +1,8 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
#
|
3
3
|
# history.rb -
|
4
|
-
# $Release Version: 0.9.6$
|
5
|
-
# $Revision$
|
6
4
|
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
7
5
|
#
|
8
|
-
# --
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
6
|
|
13
7
|
module IRB # :nodoc:
|
14
8
|
|
@@ -24,7 +18,7 @@ module IRB # :nodoc:
|
|
24
18
|
|
25
19
|
if defined?(@eval_history) && @eval_history
|
26
20
|
@eval_history_values.push @line_no, @last_value
|
27
|
-
@workspace.evaluate
|
21
|
+
@workspace.evaluate "__ = IRB.CurrentContext.instance_eval{@eval_history_values}"
|
28
22
|
end
|
29
23
|
|
30
24
|
@last_value
|
@@ -55,7 +49,7 @@ module IRB # :nodoc:
|
|
55
49
|
else
|
56
50
|
@eval_history_values = History.new(no)
|
57
51
|
IRB.conf[:__TMP__EHV__] = @eval_history_values
|
58
|
-
@workspace.evaluate(
|
52
|
+
@workspace.evaluate("__ = IRB.conf[:__TMP__EHV__]")
|
59
53
|
IRB.conf.delete(:__TMP_EHV__)
|
60
54
|
end
|
61
55
|
else
|
data/lib/irb/ext/loader.rb
CHANGED
@@ -1,15 +1,8 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
#
|
3
3
|
# loader.rb -
|
4
|
-
# $Release Version: 0.9.6$
|
5
|
-
# $Revision$
|
6
4
|
# by Keiju ISHITSUKA(keiju@ruby-lang.org)
|
7
5
|
#
|
8
|
-
# --
|
9
|
-
#
|
10
|
-
#
|
11
|
-
#
|
12
|
-
|
13
6
|
|
14
7
|
module IRB # :nodoc:
|
15
8
|
# Raised in the event of an exception in a file loaded from an Irb session
|
@@ -31,31 +24,8 @@ module IRB # :nodoc:
|
|
31
24
|
load_file(path, priv)
|
32
25
|
end
|
33
26
|
|
34
|
-
if File.respond_to?(:absolute_path?)
|
35
|
-
def absolute_path?(path)
|
36
|
-
File.absolute_path?(path)
|
37
|
-
end
|
38
|
-
else
|
39
|
-
separator =
|
40
|
-
if File::ALT_SEPARATOR
|
41
|
-
"[#{Regexp.quote(File::SEPARATOR + File::ALT_SEPARATOR)}]"
|
42
|
-
else
|
43
|
-
File::SEPARATOR
|
44
|
-
end
|
45
|
-
ABSOLUTE_PATH_PATTERN = # :nodoc:
|
46
|
-
case Dir.pwd
|
47
|
-
when /\A\w:/, /\A#{separator}{2}/
|
48
|
-
/\A(?:\w:|#{separator})#{separator}/
|
49
|
-
else
|
50
|
-
/\A#{separator}/
|
51
|
-
end
|
52
|
-
def absolute_path?(path)
|
53
|
-
ABSOLUTE_PATH_PATTERN =~ path
|
54
|
-
end
|
55
|
-
end
|
56
|
-
|
57
27
|
def search_file_from_ruby_path(fn) # :nodoc:
|
58
|
-
if absolute_path?(fn)
|
28
|
+
if File.absolute_path?(fn)
|
59
29
|
return fn if File.exist?(fn)
|
60
30
|
return nil
|
61
31
|
end
|
data/lib/irb/ext/multi-irb.rb
CHANGED