irb 1.15.0 → 1.15.2

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5167476c1b7e39f80080c2970d4974dac3a84a6721c027f0429ae9c793dfba92
4
- data.tar.gz: 357002e006b01bbfd46dc36bae924c9b79adefc9b213b341fcc0f80134d0579c
3
+ metadata.gz: 0777b40af32d70077c30a5c818b82f9b7d6b1962a59648667016fe3b2a5bdc92
4
+ data.tar.gz: 3487682618e9aa452daaabd727117182dc95d85885a0b18b0b348f67e8a75f6e
5
5
  SHA512:
6
- metadata.gz: baeace22dd0cc116af8ddc4126fa6fee4b314008ffa56632547047501aefd6d8806e3d9a3518cd576422b8751ec285cb837c93b924a1f12c6230cd701c72f802
7
- data.tar.gz: b9bce4b85a77cada09e1d4f06394aee7540cd307e9ce321a2ce5d609a3f6ee2f80dbcb1fce04374bddffb9f2a5370792a4b1498aa9479f8fd11d5340dd24da6a
6
+ metadata.gz: 528a9784ba5b854519684bbe4cd03a7e6467b3619035d90ca7b7b864300b1dc22a4d755b1824ed5d653bd46e26631d88b577bfdecd6aeed24df16302471df47c
7
+ data.tar.gz: 9b401a6e0c08bdc361232be10797e307ac94567414300f7b385ae65392340aeb3ccd88ad53e447d8fb3543211ca55e2f61beb1d9543dd593a41fa736ed42c86f
data/irb.gemspec CHANGED
@@ -33,7 +33,9 @@ Gem::Specification.new do |spec|
33
33
  "exe/irb",
34
34
  "irb.gemspec",
35
35
  "man/irb.1",
36
- ] + Dir.glob("lib/**/*")
36
+ ] + Dir.chdir(File.expand_path('..', __FILE__)) do
37
+ Dir.glob("lib/**/*").map {|f| f unless File.directory?(f) }.compact
38
+ end
37
39
  spec.bindir = "exe"
38
40
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
39
41
  spec.require_paths = ["lib"]
@@ -26,10 +26,11 @@ module IRB
26
26
 
27
27
  def winsize
28
28
  if instance_variable_defined?(:@stdout) && @stdout.tty?
29
- @stdout.winsize
30
- else
31
- [24, 80]
29
+ winsize = @stdout.winsize
30
+ # If width or height is 0, something is wrong.
31
+ return winsize unless winsize.include? 0
32
32
  end
33
+ [24, 80]
33
34
  end
34
35
 
35
36
  # Whether this input method is still readable when there is no more data to
@@ -175,10 +176,15 @@ module IRB
175
176
  class ReadlineInputMethod < StdioInputMethod
176
177
  class << self
177
178
  def initialize_readline
178
- require "readline"
179
- rescue LoadError
180
- else
181
- include ::Readline
179
+ return if defined?(self::Readline)
180
+
181
+ begin
182
+ require 'readline'
183
+ const_set(:Readline, ::Readline)
184
+ rescue LoadError
185
+ const_set(:Readline, ::Reline)
186
+ end
187
+ const_set(:HISTORY, self::Readline::HISTORY)
182
188
  end
183
189
  end
184
190
 
@@ -216,8 +222,8 @@ module IRB
216
222
  def gets
217
223
  Readline.input = @stdin
218
224
  Readline.output = @stdout
219
- if l = readline(@prompt, false)
220
- HISTORY.push(l) if !l.empty?
225
+ if l = Readline.readline(@prompt, false)
226
+ Readline::HISTORY.push(l) if !l.empty?
221
227
  @line[@line_no += 1] = l + "\n"
222
228
  else
223
229
  @eof = true
@@ -239,7 +245,7 @@ module IRB
239
245
 
240
246
  # For debug message
241
247
  def inspect
242
- readline_impl = (defined?(Reline) && Readline == Reline) ? 'Reline' : 'ext/readline'
248
+ readline_impl = Readline == ::Reline ? 'Reline' : 'ext/readline'
243
249
  str = "ReadlineInputMethod with #{readline_impl} #{Readline::VERSION}"
244
250
  inputrc_path = File.expand_path(ENV['INPUTRC'] || '~/.inputrc')
245
251
  str += " and #{inputrc_path}" if File.exist?(inputrc_path)
data/lib/irb/pager.rb CHANGED
@@ -152,11 +152,13 @@ module IRB
152
152
  end
153
153
 
154
154
  def puts(text = '')
155
+ text = text.to_s unless text.is_a?(String)
155
156
  write(text)
156
157
  write("\n") unless text.end_with?("\n")
157
158
  end
158
159
 
159
160
  def write(text)
161
+ text = text.to_s unless text.is_a?(String)
160
162
  @string << text
161
163
  if @multipage
162
164
  if @delay_until && Time.now > @delay_until
@@ -171,23 +173,24 @@ module IRB
171
173
  text = text[0, overflow_size]
172
174
  overflow = true
173
175
  end
174
-
175
176
  @buffer << text
176
- @col += Reline::Unicode.calculate_width(text)
177
+ @col += Reline::Unicode.calculate_width(text, true)
177
178
  if text.include?("\n") || @col >= @width
178
179
  @buffer.lines.each do |line|
179
180
  wrapped_lines = Reline::Unicode.split_by_width(line.chomp, @width).first.compact
180
181
  wrapped_lines.pop if wrapped_lines.last == ''
181
182
  @lines.concat(wrapped_lines)
182
- if @lines.empty?
183
- @lines << "\n"
184
- elsif line.end_with?("\n")
185
- @lines[-1] += "\n"
183
+ if line.end_with?("\n")
184
+ if @lines.empty? || @lines.last.end_with?("\n")
185
+ @lines << "\n"
186
+ else
187
+ @lines[-1] += "\n"
188
+ end
186
189
  end
187
190
  end
188
191
  @buffer.clear
189
- @buffer << @lines.pop unless @lines.last.end_with?("\n")
190
- @col = Reline::Unicode.calculate_width(@buffer)
192
+ @buffer << @lines.pop if !@lines.empty? && !@lines.last.end_with?("\n")
193
+ @col = Reline::Unicode.calculate_width(@buffer, true)
191
194
  end
192
195
  if overflow || @lines.size > @height || (@lines.size == @height && @col > 0)
193
196
  @first_page_lines = @lines.take(@height)
data/lib/irb/version.rb CHANGED
@@ -5,7 +5,7 @@
5
5
  #
6
6
 
7
7
  module IRB # :nodoc:
8
- VERSION = "1.15.0"
8
+ VERSION = "1.15.2"
9
9
  @RELEASE_VERSION = VERSION
10
- @LAST_UPDATE_DATE = "2025-01-21"
10
+ @LAST_UPDATE_DATE = "2025-04-03"
11
11
  end
metadata CHANGED
@@ -1,15 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: irb
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.15.0
4
+ version: 1.15.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - aycabta
8
8
  - Keiju ISHITSUKA
9
- autorequire:
10
9
  bindir: exe
11
10
  cert_chain: []
12
- date: 2025-01-21 00:00:00.000000000 Z
11
+ date: 2025-04-03 00:00:00.000000000 Z
13
12
  dependencies:
14
13
  - !ruby/object:Gem::Dependency
15
14
  name: reline
@@ -157,7 +156,6 @@ metadata:
157
156
  source_code_uri: https://github.com/ruby/irb
158
157
  documentation_uri: https://ruby.github.io/irb/
159
158
  changelog_uri: https://github.com/ruby/irb/releases
160
- post_install_message:
161
159
  rdoc_options: []
162
160
  require_paths:
163
161
  - lib
@@ -172,8 +170,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
172
170
  - !ruby/object:Gem::Version
173
171
  version: '0'
174
172
  requirements: []
175
- rubygems_version: 3.5.11
176
- signing_key:
173
+ rubygems_version: 3.6.3
177
174
  specification_version: 4
178
175
  summary: Interactive Ruby command-line tool for REPL (Read Eval Print Loop).
179
176
  test_files: []