irb 1.0.0 → 1.1.0.pre.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/irb.gemspec +1 -1
- data/lib/irb.rb +11 -8
- data/lib/irb/cmd/fork.rb +1 -1
- data/lib/irb/completion.rb +125 -30
- data/lib/irb/context.rb +55 -36
- data/lib/irb/ext/save-history.rb +6 -4
- data/lib/irb/init.rb +9 -4
- data/lib/irb/input-method.rb +96 -0
- data/lib/irb/inspector.rb +12 -2
- data/lib/irb/lc/help-message +2 -1
- data/lib/irb/lc/ja/help-message +2 -2
- data/lib/irb/ruby-lex.rb +216 -1063
- data/lib/irb/version.rb +2 -2
- data/lib/irb/workspace.rb +24 -6
- metadata +5 -12
- data/.gitignore +0 -9
- data/.travis.yml +0 -6
- data/Gemfile +0 -5
- data/Rakefile +0 -10
- data/bin/console +0 -6
- data/bin/setup +0 -6
data/lib/irb/version.rb
CHANGED
data/lib/irb/workspace.rb
CHANGED
@@ -49,7 +49,7 @@ EOF
|
|
49
49
|
@binding = BINDING_QUEUE.pop
|
50
50
|
|
51
51
|
when 3 # binding in function on TOPLEVEL_BINDING(default)
|
52
|
-
@binding = eval("def irb_binding; private; binding; end; irb_binding",
|
52
|
+
@binding = eval("self.class.send(:remove_method, :irb_binding) if defined?(irb_binding); def irb_binding; private; binding; end; irb_binding",
|
53
53
|
TOPLEVEL_BINDING,
|
54
54
|
__FILE__,
|
55
55
|
__LINE__ - 3)
|
@@ -116,25 +116,43 @@ EOF
|
|
116
116
|
end
|
117
117
|
|
118
118
|
def code_around_binding
|
119
|
-
|
119
|
+
if @binding.respond_to?(:source_location)
|
120
|
+
file, pos = @binding.source_location
|
121
|
+
else
|
122
|
+
file, pos = @binding.eval('[__FILE__, __LINE__]')
|
123
|
+
end
|
120
124
|
|
121
|
-
|
125
|
+
if defined?(::SCRIPT_LINES__[file]) && lines = ::SCRIPT_LINES__[file]
|
126
|
+
code = ::SCRIPT_LINES__[file].join('')
|
127
|
+
else
|
122
128
|
begin
|
123
|
-
|
129
|
+
code = File.read(file)
|
124
130
|
rescue SystemCallError
|
125
131
|
return
|
126
132
|
end
|
127
133
|
end
|
134
|
+
|
135
|
+
# NOT using #use_colorize? of IRB.conf[:MAIN_CONTEXT] because this method may be called before IRB::Irb#run
|
136
|
+
use_colorize = IRB.conf.fetch(:USE_COLORIZE, true)
|
137
|
+
if use_colorize
|
138
|
+
lines = Color.colorize_code(code).lines
|
139
|
+
else
|
140
|
+
lines = code.lines
|
141
|
+
end
|
128
142
|
pos -= 1
|
129
143
|
|
130
144
|
start_pos = [pos - 5, 0].max
|
131
145
|
end_pos = [pos + 5, lines.size - 1].min
|
132
146
|
|
133
|
-
|
147
|
+
if use_colorize
|
148
|
+
fmt = " %2s #{Color.colorize("%#{end_pos.to_s.length}d", [:BLUE, :BOLD])}: %s"
|
149
|
+
else
|
150
|
+
fmt = " %2s %#{end_pos.to_s.length}d: %s"
|
151
|
+
end
|
134
152
|
body = (start_pos..end_pos).map do |current_pos|
|
135
153
|
sprintf(fmt, pos == current_pos ? '=>' : '', current_pos + 1, lines[current_pos])
|
136
154
|
end.join("")
|
137
|
-
"\nFrom: #{file} @ line #{pos + 1} :\n\n#{body}\n"
|
155
|
+
"\nFrom: #{file} @ line #{pos + 1} :\n\n#{body}#{Color.clear}\n"
|
138
156
|
end
|
139
157
|
|
140
158
|
def IRB.delete_caller
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: irb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.1.0.pre.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Keiju ISHITSUKA
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -46,14 +46,8 @@ executables:
|
|
46
46
|
extensions: []
|
47
47
|
extra_rdoc_files: []
|
48
48
|
files:
|
49
|
-
- ".gitignore"
|
50
|
-
- ".travis.yml"
|
51
|
-
- Gemfile
|
52
49
|
- LICENSE.txt
|
53
50
|
- README.md
|
54
|
-
- Rakefile
|
55
|
-
- bin/console
|
56
|
-
- bin/setup
|
57
51
|
- exe/irb
|
58
52
|
- irb.gemspec
|
59
53
|
- lib/irb.rb
|
@@ -113,12 +107,11 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
113
107
|
version: '0'
|
114
108
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
109
|
requirements:
|
116
|
-
- - "
|
110
|
+
- - ">"
|
117
111
|
- !ruby/object:Gem::Version
|
118
|
-
version:
|
112
|
+
version: 1.3.1
|
119
113
|
requirements: []
|
120
|
-
|
121
|
-
rubygems_version: 2.7.6
|
114
|
+
rubygems_version: 3.0.4
|
122
115
|
signing_key:
|
123
116
|
specification_version: 4
|
124
117
|
summary: Interactive Ruby command-line tool for REPL (Read Eval Print Loop).
|
data/.gitignore
DELETED
data/.travis.yml
DELETED
data/Gemfile
DELETED
data/Rakefile
DELETED
data/bin/console
DELETED