irb 1.3.8.pre.9 → 1.3.8.pre.10

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: dc37bc2cdd7bf77d09704fb22c31aec464fc7aa391f2bc6a6619d8549bd0cd5d
4
- data.tar.gz: 20b8157c7167ccf5b30fef3d4b8340c3d1a316a59c742c968d0e62e0bd5010d7
3
+ metadata.gz: 64245fa0213491e1a1340223cad9978a831a4cb95c30583947d1580f781fa916
4
+ data.tar.gz: 971cb2a3ef3631d3489202f13e070c43966d4e981dae846ca2756248afb2285f
5
5
  SHA512:
6
- metadata.gz: 9783aa13399d0eddb2e67cf3aa51760cfde1cc76f7b59d78158e83746359511e46824034d29f07181ffc91a51901bb6202562b8eab950649c0082f58295809d0
7
- data.tar.gz: f2a27869c90d81a93497515c38da52c0e19c113a308c95c264b863fb8edc9e1f96f558343bbe4bfe47b6a527ce4eaa98757380b700626d9f445f12b994b296d2
6
+ metadata.gz: 1547d50d86acaeeb7edc4dc0d68fd9cf2f025f82f1f7e47728d8212776506cd485dcd96c39c5b429e8b7c2f83afc1698042b976797fa2e26d4ba2b4faba7e186
7
+ data.tar.gz: d18b3174329d2c7f253dfcfbff40656ceaf2fd42fa603468e0bb48eba6e4057c6e5fdc06874f1d7701f5be47d072aa0aa2b024bdb7e8a80e6644041e2af5b03e
data/doc/irb/irb.rd.ja CHANGED
@@ -51,6 +51,12 @@ irbの使い方は, Rubyさえ知っていればいたって簡単です. 基本
51
51
  オブジェクトの作成方法を 0 から 3 のいずれかに設定する.
52
52
  --echo 実行結果を表示する(デフォルト).
53
53
  --noecho 実行結果を表示しない.
54
+ --echo-on-assignment
55
+ 代入時に実行結果を表示する.
56
+ --noecho-on-assignment
57
+ 代入時に実行結果を表示しない.
58
+ --truncate-echo-on-assignment
59
+ 代入時に省略された実行結果を表示する(デフォルト).
54
60
  --inspect 結果出力にinspectを用いる.
55
61
  --noinspect 結果出力にinspectを用いない.
56
62
  --singleline シングルラインエディタを利用する.
data/irb.gemspec CHANGED
@@ -36,5 +36,5 @@ Gem::Specification.new do |spec|
36
36
 
37
37
  spec.required_ruby_version = Gem::Requirement.new(">= 2.5")
38
38
 
39
- spec.add_dependency "reline", ">= 0.2.8.pre.9"
39
+ spec.add_dependency "reline", ">= 0.2.8.pre.10"
40
40
  end
@@ -59,23 +59,27 @@ module IRB
59
59
  File.join(s.full_gem_path, p)
60
60
  end
61
61
  }
62
- }.flatten
63
- (gem_paths + $LOAD_PATH).uniq.sort
62
+ }.flatten if defined?(Gem::Specification)
63
+ (gem_paths.to_a | $LOAD_PATH).sort
64
64
  end
65
65
 
66
66
  def self.retrieve_files_to_require_from_load_path
67
- @@files_from_load_path ||= retrieve_gem_and_system_load_path.map { |path|
68
- begin
69
- Dir.glob("**/*.{rb,#{RbConfig::CONFIG['DLEXT']}}", base: path)
70
- rescue Errno::ENOENT
71
- []
72
- end
73
- }.inject([]) { |result, names|
74
- shortest, *rest = names.map{ |n| n.sub(/\.(rb|#{RbConfig::CONFIG['DLEXT']})\z/, '') }.sort
75
- result.unshift(shortest) if shortest
76
- result.concat(rest)
77
- result
78
- }.uniq
67
+ @@files_from_load_path ||=
68
+ (
69
+ shortest = []
70
+ rest = retrieve_gem_and_system_load_path.each_with_object([]) { |path, result|
71
+ begin
72
+ names = Dir.glob("**/*.{rb,#{RbConfig::CONFIG['DLEXT']}}", base: path)
73
+ rescue Errno::ENOENT
74
+ nil
75
+ end
76
+ next if names.empty?
77
+ names.map! { |n| n.sub(/\.(rb|#{RbConfig::CONFIG['DLEXT']})\z/, '') }.sort!
78
+ shortest << names.shift
79
+ result.concat(names)
80
+ }
81
+ shortest.sort! | rest
82
+ )
79
83
  end
80
84
 
81
85
  def self.retrieve_files_to_require_relative_from_current_dir
@@ -188,7 +192,7 @@ module IRB
188
192
  sym = $1
189
193
  candidates = Symbol.all_symbols.collect do |s|
190
194
  ":" + s.id2name.encode(Encoding.default_external)
191
- rescue Encoding::UndefinedConversionError
195
+ rescue EncodingError
192
196
  # ignore
193
197
  end
194
198
  candidates.grep(/^#{Regexp.quote(sym)}/)
@@ -286,7 +290,7 @@ module IRB
286
290
  all_gvars.grep(Regexp.new(Regexp.quote(gvar)))
287
291
  end
288
292
 
289
- when /^([^."].*)(\.|::)([^.]*)$/
293
+ when /^([^.:"].*)(\.|::)([^.]*)$/
290
294
  # variable.func or func.func
291
295
  receiver = $1
292
296
  sep = $2
data/lib/irb/context.rb CHANGED
@@ -264,13 +264,28 @@ module IRB
264
264
  #
265
265
  # a = "omg"
266
266
  # #=> omg
267
+ #
267
268
  # a = "omg" * 10
268
269
  # #=> omgomgomgomgomgomgomg...
270
+ #
269
271
  # IRB.CurrentContext.echo_on_assignment = false
270
272
  # a = "omg"
273
+ #
271
274
  # IRB.CurrentContext.echo_on_assignment = true
272
- # a = "omg"
275
+ # a = "omg" * 10
273
276
  # #=> omgomgomgomgomgomgomgomgomgomg
277
+ #
278
+ # To set the behaviour of showing on assignment in irb:
279
+ #
280
+ # IRB.conf[:ECHO_ON_ASSIGNMENT] = :truncate or true or false
281
+ #
282
+ # or
283
+ #
284
+ # irb_context.echo_on_assignment = :truncate or true or false
285
+ #
286
+ # or
287
+ #
288
+ # IRB.CurrentContext.echo_on_assignment = :truncate or true or false
274
289
  attr_accessor :echo_on_assignment
275
290
  # Whether a newline is put before multiline output.
276
291
  #
@@ -20,8 +20,14 @@ Usage: irb.rb [options] [programfile] [arguments]
20
20
  -W[level=2] Same as `ruby -W`
21
21
  --context-mode n Set n[0-4] to method to create Binding Object,
22
22
  when new workspace was created
23
- --echo Show result(default)
23
+ --echo Show result (default)
24
24
  --noecho Don't show result
25
+ --echo-on-assignment
26
+ Show result on assignment
27
+ --noecho-on-assignment
28
+ Don't show result on assignment
29
+ --truncate-echo-on-assignment
30
+ Show truncated result on assignment (default)
25
31
  --inspect Use `inspect' for output
26
32
  --noinspect Don't use inspect for output
27
33
  --multiline Use multiline editor module
data/lib/irb/ruby-lex.rb CHANGED
@@ -207,7 +207,7 @@ class RubyLex
207
207
  last_line = lines[line_index]&.byteslice(0, byte_pointer)
208
208
  code += last_line if last_line
209
209
  @tokens = self.class.ripper_lex_without_warning(code, context: context)
210
- corresponding_token_depth = check_corresponding_token_depth
210
+ corresponding_token_depth = check_corresponding_token_depth(lines, line_index)
211
211
  if corresponding_token_depth
212
212
  corresponding_token_depth
213
213
  else
@@ -603,7 +603,7 @@ class RubyLex
603
603
  depth_difference
604
604
  end
605
605
 
606
- def check_corresponding_token_depth
606
+ def check_corresponding_token_depth(lines, line_index)
607
607
  corresponding_token_depth = nil
608
608
  is_first_spaces_of_line = true
609
609
  is_first_printable_of_line = true
@@ -611,6 +611,11 @@ class RubyLex
611
611
  spaces_at_line_head = 0
612
612
  open_brace_on_line = 0
613
613
  in_oneliner_def = nil
614
+
615
+ if heredoc_scope?
616
+ return lines[line_index][/^ */].length
617
+ end
618
+
614
619
  @tokens.each_with_index do |t, index|
615
620
  # detecting one-liner method definition
616
621
  if in_oneliner_def.nil?
@@ -817,5 +822,12 @@ class RubyLex
817
822
  end
818
823
  false
819
824
  end
825
+
826
+ private
827
+
828
+ def heredoc_scope?
829
+ heredoc_tokens = @tokens.select { |t| [:on_heredoc_beg, :on_heredoc_end].include?(t.event) }
830
+ heredoc_tokens[-1]&.event == :on_heredoc_beg
831
+ end
820
832
  end
821
833
  # :startdoc:
data/lib/irb/version.rb CHANGED
@@ -11,7 +11,7 @@
11
11
  #
12
12
 
13
13
  module IRB # :nodoc:
14
- VERSION = "1.3.8.pre.9"
14
+ VERSION = "1.3.8.pre.10"
15
15
  @RELEASE_VERSION = VERSION
16
- @LAST_UPDATE_DATE = "2021-09-10"
16
+ @LAST_UPDATE_DATE = "2021-10-03"
17
17
  end
data/lib/irb.rb CHANGED
@@ -62,8 +62,14 @@ require_relative "irb/easter-egg"
62
62
  # -W[level=2] Same as `ruby -W`
63
63
  # --context-mode n Set n[0-4] to method to create Binding Object,
64
64
  # when new workspace was created
65
- # --echo Show result(default)
65
+ # --echo Show result (default)
66
66
  # --noecho Don't show result
67
+ # --echo-on-assignment
68
+ # Show result on assignment
69
+ # --noecho-on-assignment
70
+ # Don't show result on assignment
71
+ # --truncate-echo-on-assignment
72
+ # Show truncated result on assignment (default)
67
73
  # --inspect Use `inspect' for output
68
74
  # --noinspect Don't use inspect for output
69
75
  # --multiline Use multiline editor module
data/man/irb.1 CHANGED
@@ -106,12 +106,22 @@ Doesn't use singleline editor module.
106
106
  .Pp
107
107
  .Pp
108
108
  .It Fl -echo
109
- Show result(default).
109
+ Show result (default).
110
110
  .Pp
111
111
  .It Fl -noecho
112
112
  Don't show result.
113
113
  .Pp
114
114
  .Pp
115
+ .It Fl -echo-on-assignment
116
+ Show result on assignment.
117
+ .Pp
118
+ .It Fl -noecho-on-assignment
119
+ Don't show result on assignment.
120
+ .Pp
121
+ .It Fl -truncate-echo-on-assignment
122
+ Show truncated result on assignment (default).
123
+ .Pp
124
+ .Pp
115
125
  .It Fl -colorize
116
126
  Use colorization.
117
127
  .Pp
metadata CHANGED
@@ -1,29 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: irb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.8.pre.9
4
+ version: 1.3.8.pre.10
5
5
  platform: ruby
6
6
  authors:
7
7
  - Keiju ISHITSUKA
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-09-10 00:00:00.000000000 Z
11
+ date: 2021-10-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: reline
15
- prerelease: false
16
15
  requirement: !ruby/object:Gem::Requirement
17
16
  requirements:
18
17
  - - ">="
19
18
  - !ruby/object:Gem::Version
20
- version: 0.2.8.pre.9
19
+ version: 0.2.8.pre.10
21
20
  type: :runtime
21
+ prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - ">="
25
25
  - !ruby/object:Gem::Version
26
- version: 0.2.8.pre.9
26
+ version: 0.2.8.pre.10
27
27
  description: Interactive Ruby command-line tool for REPL (Read Eval Print Loop).
28
28
  email:
29
29
  - keiju@ruby-lang.org
@@ -97,7 +97,7 @@ licenses:
97
97
  - Ruby
98
98
  - BSD-2-Clause
99
99
  metadata: {}
100
- post_install_message:
100
+ post_install_message:
101
101
  rdoc_options: []
102
102
  require_paths:
103
103
  - lib
@@ -112,8 +112,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
112
112
  - !ruby/object:Gem::Version
113
113
  version: 1.3.1
114
114
  requirements: []
115
- rubygems_version: 3.1.4
116
- signing_key:
115
+ rubygems_version: 3.2.22
116
+ signing_key:
117
117
  specification_version: 4
118
118
  summary: Interactive Ruby command-line tool for REPL (Read Eval Print Loop).
119
119
  test_files: []