irb 1.1.1 → 1.2.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.
@@ -0,0 +1,38 @@
1
+
2
+ -+smJYYN?mm-
3
+ HB"BBYT TQg NggT
4
+ 9Q+g Nm,T 8g NJW
5
+ YS+ N2NJ"Sg N?
6
+ BQg #( gT Nggggk J
7
+ 5j NJ NJ NNge
8
+ #Q #JJ NgT N(
9
+ @j bj mT J
10
+ Bj @/d NJ (
11
+ #q #(( NgT #J
12
+ 5d #(t mT $d
13
+ #q @(@J NJB;
14
+ @( 5d ? HHH H HQmgggggggmN qD
15
+ 5d #uN 2QdH E O
16
+ 5 5JSd Nd NJH @d j
17
+ Fd @J4d s NQH #d (
18
+ #( #o6d Nd NgH #d #d
19
+ 4 B&Od v NgT #d F
20
+ #( 9JGd NH NgUd F
21
+ #d #GJQ d NP $
22
+ #J #U+#Q N Q # j
23
+ j /W BQ+ BQ d NJ NJ
24
+ - NjJH HBIjTQggPJQgW N W k #J
25
+ #J b HYWgggN j s Nag d NN b #d
26
+ #J 5- D s Ngg N d Nd F
27
+ Fd BKH2 #+ s NNgg J Q J ]
28
+ F H @ J N y K(d P I
29
+ F4 E N? #d y #Q NJ E j
30
+ F W Nd q m Bg NxW N(H-
31
+ F d b @ m Hd gW vKJ
32
+ NJ d K d s Bg aT FDd
33
+ b # d N m BQ mV N>
34
+ e5 Nd #d NggggggQWH HHHH NJ -
35
+ m7 NW H N HSVO1z=?11-
36
+ NgTH bB kH WBHWWHBHWmQgg&gggggNNN
37
+ NNggggggNN
38
+
@@ -11,7 +11,7 @@
11
11
  #
12
12
 
13
13
  module IRB # :nodoc:
14
- VERSION = "1.1.1"
14
+ VERSION = "1.2.0"
15
15
  @RELEASE_VERSION = VERSION
16
- @LAST_UPDATE_DATE = "2018-12-18"
16
+ @LAST_UPDATE_DATE = "2019-12-07"
17
17
  end
@@ -9,6 +9,9 @@
9
9
  #
10
10
  #
11
11
  #
12
+
13
+ require "delegate"
14
+
12
15
  module IRB # :nodoc:
13
16
  class WorkSpace
14
17
  # Creates a new workspace.
@@ -49,17 +52,21 @@ EOF
49
52
  @binding = BINDING_QUEUE.pop
50
53
 
51
54
  when 3 # binding in function on TOPLEVEL_BINDING(default)
52
- @binding = eval("def irb_binding; private; binding; end; irb_binding",
55
+ @binding = eval("self.class.send(:remove_method, :irb_binding) if defined?(irb_binding); private; def irb_binding; binding; end; irb_binding",
53
56
  TOPLEVEL_BINDING,
54
57
  __FILE__,
55
58
  __LINE__ - 3)
56
59
  end
57
60
  end
61
+
58
62
  if main.empty?
59
63
  @main = eval("self", @binding)
60
64
  else
61
65
  @main = main[0]
62
- IRB.conf[:__MAIN__] = @main
66
+ end
67
+ IRB.conf[:__MAIN__] = @main
68
+
69
+ unless main.empty?
63
70
  case @main
64
71
  when Module
65
72
  @binding = eval("IRB.conf[:__MAIN__].module_eval('binding', __FILE__, __LINE__)", @binding, __FILE__, __LINE__)
@@ -67,10 +74,32 @@ EOF
67
74
  begin
68
75
  @binding = eval("IRB.conf[:__MAIN__].instance_eval('binding', __FILE__, __LINE__)", @binding, __FILE__, __LINE__)
69
76
  rescue TypeError
70
- IRB.fail CantChangeBinding, @main.inspect
77
+ fail CantChangeBinding, @main.inspect
78
+ end
79
+ end
80
+ end
81
+
82
+ case @main
83
+ when Object
84
+ use_delegator = @main.frozen?
85
+ else
86
+ use_delegator = true
87
+ end
88
+
89
+ if use_delegator
90
+ @main = SimpleDelegator.new(@main)
91
+ IRB.conf[:__MAIN__] = @main
92
+ @main.singleton_class.class_eval do
93
+ private
94
+ define_method(:exit) do |*a, &b|
95
+ # Do nothing, will be overridden
71
96
  end
97
+ define_method(:binding, Kernel.instance_method(:binding))
98
+ define_method(:local_variables, Kernel.instance_method(:local_variables))
72
99
  end
100
+ @binding = eval("IRB.conf[:__MAIN__].instance_eval('binding', __FILE__, __LINE__)", @binding, *@binding.source_location)
73
101
  end
102
+
74
103
  @binding.local_variable_set(:_, nil)
75
104
  end
76
105
 
@@ -95,46 +124,55 @@ EOF
95
124
 
96
125
  # error message manipulator
97
126
  def filter_backtrace(bt)
127
+ return nil if bt =~ /\/irb\/.*\.rb/
128
+ return nil if bt =~ /\/irb\.rb/
98
129
  case IRB.conf[:CONTEXT_MODE]
99
- when 0
100
- return nil if bt =~ /\(irb_local_binding\)/
101
130
  when 1
102
- if(bt =~ %r!/tmp/irb-binding! or
103
- bt =~ %r!irb/.*\.rb! or
104
- bt =~ /irb\.rb/)
105
- return nil
106
- end
107
- when 2
108
- return nil if bt =~ /irb\/.*\.rb/
109
- return nil if bt =~ /irb\.rb/
131
+ return nil if bt =~ %r!/tmp/irb-binding!
110
132
  when 3
111
- return nil if bt =~ /irb\/.*\.rb/
112
- return nil if bt =~ /irb\.rb/
113
133
  bt = bt.sub(/:\s*in `irb_binding'/, '')
114
134
  end
115
135
  bt
116
136
  end
117
137
 
118
138
  def code_around_binding
119
- file, pos = @binding.source_location
139
+ if @binding.respond_to?(:source_location)
140
+ file, pos = @binding.source_location
141
+ else
142
+ file, pos = @binding.eval('[__FILE__, __LINE__]')
143
+ end
120
144
 
121
- unless defined?(::SCRIPT_LINES__[file]) && lines = ::SCRIPT_LINES__[file]
145
+ if defined?(::SCRIPT_LINES__[file]) && lines = ::SCRIPT_LINES__[file]
146
+ code = ::SCRIPT_LINES__[file].join('')
147
+ else
122
148
  begin
123
- lines = File.readlines(file)
149
+ code = File.read(file)
124
150
  rescue SystemCallError
125
151
  return
126
152
  end
127
153
  end
154
+
155
+ # NOT using #use_colorize? of IRB.conf[:MAIN_CONTEXT] because this method may be called before IRB::Irb#run
156
+ use_colorize = IRB.conf.fetch(:USE_COLORIZE, true)
157
+ if use_colorize
158
+ lines = Color.colorize_code(code).lines
159
+ else
160
+ lines = code.lines
161
+ end
128
162
  pos -= 1
129
163
 
130
164
  start_pos = [pos - 5, 0].max
131
165
  end_pos = [pos + 5, lines.size - 1].min
132
166
 
133
- fmt = " %2s %#{end_pos.to_s.length}d: %s"
167
+ if use_colorize
168
+ fmt = " %2s #{Color.colorize("%#{end_pos.to_s.length}d", [:BLUE, :BOLD])}: %s"
169
+ else
170
+ fmt = " %2s %#{end_pos.to_s.length}d: %s"
171
+ end
134
172
  body = (start_pos..end_pos).map do |current_pos|
135
173
  sprintf(fmt, pos == current_pos ? '=>' : '', current_pos + 1, lines[current_pos])
136
174
  end.join("")
137
- "\nFrom: #{file} @ line #{pos + 1} :\n\n#{body}\n"
175
+ "\nFrom: #{file} @ line #{pos + 1} :\n\n#{body}#{Color.clear}\n"
138
176
  end
139
177
 
140
178
  def IRB.delete_caller
@@ -0,0 +1,207 @@
1
+ .\"Ruby is copyrighted by Yukihiro Matsumoto <matz@netlab.jp>.
2
+ .Dd August 11, 2019
3
+ .Dt IRB \&1 "Ruby Programmer's Reference Guide"
4
+ .Os UNIX
5
+ .Sh NAME
6
+ .Nm irb
7
+ .Nd Interactive Ruby Shell
8
+ .Sh SYNOPSIS
9
+ .Nm
10
+ .Op Fl -version
11
+ .Op Fl dfUw
12
+ .Op Fl I Ar directory
13
+ .Op Fl r Ar library
14
+ .Op Fl E Ar external Ns Op : Ns Ar internal
15
+ .Op Fl W Ns Op Ar level
16
+ .Op Fl - Ns Oo no Oc Ns inspect
17
+ .Op Fl - Ns Oo no Oc Ns multiline
18
+ .Op Fl - Ns Oo no Oc Ns singleline
19
+ .Op Fl - Ns Oo no Oc Ns echo
20
+ .Op Fl - Ns Oo no Oc Ns colorize
21
+ .Op Fl - Ns Oo no Oc Ns verbose
22
+ .Op Fl -prompt Ar mode
23
+ .Op Fl -prompt-mode Ar mode
24
+ .Op Fl -inf-ruby-mode
25
+ .Op Fl -simple-prompt
26
+ .Op Fl -noprompt
27
+ .Op Fl -tracer
28
+ .Op Fl -back-trace-limit Ar n
29
+ .Op Fl -
30
+ .Op program_file
31
+ .Op argument ...
32
+ .Pp
33
+ .Sh DESCRIPTION
34
+ .Nm
35
+ is the REPL(read-eval-print loop) environment for Ruby programs.
36
+ .Pp
37
+ .Sh OPTIONS
38
+ .Bl -tag -width "1234567890123" -compact
39
+ .Pp
40
+ .It Fl -version
41
+ Prints the version of
42
+ .Nm .
43
+ .Pp
44
+ .It Fl E Ar external Ns Op : Ns Ar internal
45
+ .It Fl -encoding Ar external Ns Op : Ns Ar internal
46
+ Same as `ruby -E' .
47
+ Specifies the default value(s) for external encodings and internal encoding. Values should be separated with colon (:).
48
+ .Pp
49
+ You can omit the one for internal encodings, then the value
50
+ .Pf ( Li "Encoding.default_internal" ) will be nil.
51
+ .Pp
52
+ .It Fl I Ar path
53
+ Same as `ruby -I' .
54
+ Specifies
55
+ .Li $LOAD_PATH
56
+ directory
57
+ .Pp
58
+ .It Fl U
59
+ Same as `ruby -U' .
60
+ Sets the default value for internal encodings
61
+ .Pf ( Li "Encoding.default_internal" ) to UTF-8.
62
+ .Pp
63
+ .It Fl d
64
+ Same as `ruby -d' .
65
+ Sets
66
+ .Li $DEBUG
67
+ to true.
68
+ .Pp
69
+ .It Fl f
70
+ Suppresses read of
71
+ .Pa ~/.irbrc .
72
+ .Pp
73
+ .It Fl w
74
+ Same as `ruby -w' .
75
+ .Pp
76
+ .Pp
77
+ .It Fl W
78
+ Same as `ruby -W' .
79
+ .Pp
80
+ .It Fl h
81
+ .It Fl -help
82
+ Prints a summary of the options.
83
+ .Pp
84
+ .It Fl r Ar library
85
+ Same as `ruby -r'.
86
+ Causes irb to load the library using require.
87
+ .Pp
88
+ .It Fl -inspect
89
+ Uses `inspect' for output (default except for bc mode)
90
+ .Pp
91
+ .It Fl -noinspect
92
+ Doesn't use inspect for output
93
+ .Pp
94
+ .It Fl -multiline
95
+ Uses multiline editor module.
96
+ .Pp
97
+ .It Fl -nomultiline
98
+ Doesn't use multiline editor module.
99
+ .Pp
100
+ .It Fl -singleline
101
+ Uses singleline editor module.
102
+ .Pp
103
+ .It Fl -nosingleline
104
+ Doesn't use singleline editor module.
105
+ .Pp
106
+ .Pp
107
+ .It Fl -echo
108
+ Show result(default).
109
+ .Pp
110
+ .It Fl -noecho
111
+ Don't show result.
112
+ .Pp
113
+ .Pp
114
+ .It Fl -colorize
115
+ Use colorization.
116
+ .Pp
117
+ .It Fl -nocolorize
118
+ Don't use colorization.
119
+ .Pp
120
+ .Pp
121
+ .It Fl -verbose
122
+ Show details.
123
+ .Pp
124
+ .It Fl -noverbose
125
+ Don't show details.
126
+ .Pp
127
+ .It Fl -prompt Ar mode
128
+ .It Fl -prompt-mode Ar mode
129
+ Switch prompt mode. Pre-defined prompt modes are
130
+ `default', `simple', `xmp' and `inf-ruby'.
131
+ .Pp
132
+ .It Fl -inf-ruby-mode
133
+ Uses prompt appropriate for inf-ruby-mode on emacs.
134
+ Suppresses --multiline and --singleline.
135
+ .Pp
136
+ .It Fl -simple-prompt
137
+ Makes prompts simple.
138
+ .Pp
139
+ .It Fl -noprompt
140
+ No prompt mode.
141
+ .Pp
142
+ .It Fl -tracer
143
+ Displays trace for each execution of commands.
144
+ .Pp
145
+ .It Fl -back-trace-limit Ar n
146
+ Displays backtrace top
147
+ .Ar n
148
+ and tail
149
+ .Ar n Ns .
150
+ The default value is 16.
151
+ .El
152
+ .Pp
153
+ .Sh ENVIRONMENT
154
+ .Bl -tag -compact
155
+ .It Ev IRBRC
156
+ .Pp
157
+ .El
158
+ .Pp
159
+ Also
160
+ .Nm
161
+ depends on same variables as
162
+ .Xr ruby 1 .
163
+ .Pp
164
+ .Sh FILES
165
+ .Bl -tag -compact
166
+ .It Pa ~/.irbrc
167
+ Personal irb initialization.
168
+ .Pp
169
+ .El
170
+ .Pp
171
+ .Sh EXAMPLES
172
+ .Dl % irb
173
+ .Dl irb(main):001:0> Ic 1 + 1
174
+ .Dl 2
175
+ .Dl irb(main):002:0> Ic def t(x)
176
+ .Dl irb(main):003:1> Ic x + 1
177
+ .Dl irb(main):004:1> Ic end
178
+ .Dl => :t
179
+ .Dl irb(main):005:0> Ic t(3)
180
+ .Dl => 4
181
+ .Dl irb(main):006:0> Ic if t(3) == 4
182
+ .Dl irb(main):007:1> Ic p :ok
183
+ .Dl irb(main):008:1> Ic end
184
+ .Dl :ok
185
+ .Dl => :ok
186
+ .Dl irb(main):009:0> Ic quit
187
+ .Dl %
188
+ .Pp
189
+ .Sh SEE ALSO
190
+ .Xr ruby 1 .
191
+ .Pp
192
+ .Sh REPORTING BUGS
193
+ .Bl -bullet
194
+ .It
195
+ Security vulnerabilities should be reported via an email to
196
+ .Mt security@ruby-lang.org .
197
+ Reported problems will be published after being fixed.
198
+ .Pp
199
+ .It
200
+ Other bugs and feature requests can be reported via the
201
+ Ruby Issue Tracking System
202
+ .Pq Lk https://bugs.ruby-lang.org/ .
203
+ Do not report security vulnerabilities
204
+ via this system because it publishes the vulnerabilities immediately.
205
+ .El
206
+ .Sh AUTHORS
207
+ Written by Keiju ISHITSUKA.
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.1.1
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keiju ISHITSUKA
@@ -10,6 +10,20 @@ bindir: exe
10
10
  cert_chain: []
11
11
  date: 2019-12-07 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: reline
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - ">="
18
+ - !ruby/object:Gem::Version
19
+ version: 0.0.1
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - ">="
25
+ - !ruby/object:Gem::Version
26
+ version: 0.0.1
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: bundler
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -46,14 +60,14 @@ executables:
46
60
  extensions: []
47
61
  extra_rdoc_files: []
48
62
  files:
49
- - ".gitignore"
50
- - ".travis.yml"
51
63
  - Gemfile
52
64
  - LICENSE.txt
53
65
  - README.md
54
66
  - Rakefile
55
67
  - bin/console
56
68
  - bin/setup
69
+ - doc/irb/irb-tools.rd.ja
70
+ - doc/irb/irb.rd.ja
57
71
  - exe/irb
58
72
  - irb.gemspec
59
73
  - lib/irb.rb
@@ -64,6 +78,7 @@ files:
64
78
  - lib/irb/cmd/nop.rb
65
79
  - lib/irb/cmd/pushws.rb
66
80
  - lib/irb/cmd/subirb.rb
81
+ - lib/irb/color.rb
67
82
  - lib/irb/completion.rb
68
83
  - lib/irb/context.rb
69
84
  - lib/irb/ext/change-ws.rb
@@ -91,13 +106,13 @@ files:
91
106
  - lib/irb/notifier.rb
92
107
  - lib/irb/output-method.rb
93
108
  - lib/irb/ruby-lex.rb
94
- - lib/irb/ruby-token.rb
95
- - lib/irb/slex.rb
109
+ - lib/irb/ruby_logo.aa
96
110
  - lib/irb/src_encoding.rb
97
111
  - lib/irb/version.rb
98
112
  - lib/irb/workspace.rb
99
113
  - lib/irb/ws-for-case-2.rb
100
114
  - lib/irb/xmp.rb
115
+ - man/irb.1
101
116
  homepage: https://github.com/ruby/irb
102
117
  licenses:
103
118
  - BSD-2-Clause
@@ -110,7 +125,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
110
125
  requirements:
111
126
  - - ">="
112
127
  - !ruby/object:Gem::Version
113
- version: '0'
128
+ version: '2.5'
114
129
  required_rubygems_version: !ruby/object:Gem::Requirement
115
130
  requirements:
116
131
  - - ">="