irb 1.2.8 → 1.2.9

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: 6ffc4aa655192040fa6afa339ebd3a440a0edab364b8adb43879b46b4437bb7d
4
- data.tar.gz: b8abfe5e41f5685a487458d6c8dde123151b4e49814850d39bb54ac159614850
3
+ metadata.gz: cb526faa67bbfaad97480a6e642dc161725c6c444dcb6e6080498fae665173a6
4
+ data.tar.gz: 58c89d71946d694826f2409eaf4a49ed88644bf640564e2f3a6c9ab3d8e9c0e1
5
5
  SHA512:
6
- metadata.gz: fb7613e840270144cf31aeeffa2ae70367492c79a47dcae24da0ff90c69ca8c089efb031f52972b50be02db816ad4e35a493b654f2a43e7639f1fdf9c55060e7
7
- data.tar.gz: d587ad70d0d944a7c9f0ca58adff4adf0055d3d1f6aa3052f4d2783cf04f4184689d6e16dff173bddf1755543eedecd4308da6db113aca644502ce4aa46274d3
6
+ metadata.gz: 9e101c1374b8ea161ec76217739ce5dbcd93c9e85e3cc147852717634085b97e5bd1aa71a9a6c316a660e9c60f0d16a03d08c26e7b7e65bdbb44886295bfa8dd
7
+ data.tar.gz: 6243fb79d8747f0c507ebbd7e3f4efd486b3848ea7b2bf4db5ee4bb48591ee20857bcf5d86f61520c7d17b1d9307dc28a2ac785a64dda83ba1c78ebff90d53b6
data/lib/irb.rb CHANGED
@@ -544,9 +544,10 @@ module IRB
544
544
  if IRB.conf[:MEASURE] && !IRB.conf[:MEASURE_CALLBACKS].empty?
545
545
  result = nil
546
546
  last_proc = proc{ result = @context.evaluate(line, line_no, exception: exc) }
547
- IRB.conf[:MEASURE_CALLBACKS].map{ |s| s.last }.inject(last_proc) { |chain, item|
547
+ IRB.conf[:MEASURE_CALLBACKS].inject(last_proc) { |chain, item|
548
+ _name, callback, arg = item
548
549
  proc {
549
- item.(@context, line, line_no, exception: exc) do
550
+ callback.(@context, line, line_no, arg, exception: exc) do
550
551
  chain.call
551
552
  end
552
553
  }
@@ -120,7 +120,7 @@ module IRB # :nodoc:
120
120
  puts 'processing time: %fs' % (now - time) if IRB.conf[:MEASURE]
121
121
  result
122
122
  }
123
- @CONF[:MEASURE_PROC][:STACKPROF] = proc { |context, code, line_no, &block|
123
+ @CONF[:MEASURE_PROC][:STACKPROF] = proc { |context, code, line_no, arg, &block|
124
124
  success = false
125
125
  begin
126
126
  require 'stackprof'
@@ -130,7 +130,7 @@ module IRB # :nodoc:
130
130
  end
131
131
  if success
132
132
  result = nil
133
- stackprof_result = StackProf.run(mode: :cpu) do
133
+ stackprof_result = StackProf.run(mode: arg ? arg : :cpu) do
134
134
  result = block.()
135
135
  end
136
136
  StackProf::Report.new(stackprof_result).print_text if IRB.conf[:MEASURE]
@@ -146,17 +146,17 @@ module IRB # :nodoc:
146
146
  @CONF[:AT_EXIT] = []
147
147
  end
148
148
 
149
- def IRB.set_measure_callback(type = nil)
149
+ def IRB.set_measure_callback(type = nil, arg = nil)
150
150
  added = nil
151
151
  if type
152
152
  type_sym = type.upcase.to_sym
153
153
  if IRB.conf[:MEASURE_PROC][type_sym]
154
- added = [type_sym, IRB.conf[:MEASURE_PROC][type_sym]]
154
+ added = [type_sym, IRB.conf[:MEASURE_PROC][type_sym], arg]
155
155
  end
156
156
  elsif IRB.conf[:MEASURE_PROC][:CUSTOM]
157
- added = [:CUSTOM, IRB.conf[:MEASURE_PROC][:CUSTOM]]
157
+ added = [:CUSTOM, IRB.conf[:MEASURE_PROC][:CUSTOM], arg]
158
158
  else
159
- added = [:TIME, IRB.conf[:MEASURE_PROC][:TIME]]
159
+ added = [:TIME, IRB.conf[:MEASURE_PROC][:TIME], arg]
160
160
  end
161
161
  IRB.conf[:MEASURE_CALLBACKS] << added if added
162
162
  added
@@ -167,7 +167,7 @@ module IRB # :nodoc:
167
167
  IRB.conf[:MEASURE_CALLBACKS].clear
168
168
  else
169
169
  type_sym = type.upcase.to_sym
170
- IRB.conf[:MEASURE_CALLBACKS].reject!{ |t, c| t == type_sym }
170
+ IRB.conf[:MEASURE_CALLBACKS].reject!{ |t, | t == type_sym }
171
171
  end
172
172
  end
173
173
 
@@ -201,14 +201,14 @@ class RubyLex
201
201
  code = @line + (line.nil? ? '' : line)
202
202
  code.gsub!(/\s*\z/, '').concat("\n")
203
203
  @tokens = ripper_lex_without_warning(code)
204
- @continue = process_continue(@tokens)
205
- @code_block_open = check_code_block(code, @tokens)
206
- @indent = process_nesting_level(@tokens)
207
- @ltype = process_literal_type(@tokens)
204
+ @continue = process_continue
205
+ @code_block_open = check_code_block(code)
206
+ @indent = process_nesting_level
207
+ @ltype = process_literal_type
208
208
  line
209
209
  end
210
210
 
211
- def process_continue(tokens)
211
+ def process_continue(tokens = @tokens)
212
212
  # last token is always newline
213
213
  if tokens.size >= 2 and tokens[-2][1] == :on_regexp_end
214
214
  # end of regexp literal
@@ -228,7 +228,7 @@ class RubyLex
228
228
  false
229
229
  end
230
230
 
231
- def check_code_block(code, tokens)
231
+ def check_code_block(code, tokens = @tokens)
232
232
  return true if tokens.empty?
233
233
  if tokens.last[1] == :on_heredoc_beg
234
234
  return true
@@ -321,7 +321,7 @@ class RubyLex
321
321
  false
322
322
  end
323
323
 
324
- def process_nesting_level(tokens)
324
+ def process_nesting_level(tokens = @tokens)
325
325
  indent = 0
326
326
  in_oneliner_def = nil
327
327
  tokens.each_with_index { |t, index|
@@ -574,7 +574,7 @@ class RubyLex
574
574
  start_token.last.nil? ? '' : start_token.last
575
575
  end
576
576
 
577
- def process_literal_type(tokens)
577
+ def process_literal_type(tokens = @tokens)
578
578
  start_token = check_string_literal(tokens)
579
579
  case start_token[1]
580
580
  when :on_tstring_beg
@@ -11,7 +11,7 @@
11
11
  #
12
12
 
13
13
  module IRB # :nodoc:
14
- VERSION = "1.2.8"
14
+ VERSION = "1.2.9"
15
15
  @RELEASE_VERSION = VERSION
16
- @LAST_UPDATE_DATE = "2020-12-20"
16
+ @LAST_UPDATE_DATE = "2020-12-22"
17
17
  end
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.2.8
4
+ version: 1.2.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keiju ISHITSUKA
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-12-20 00:00:00.000000000 Z
11
+ date: 2020-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: reline