[前][次][番号順一覧][スレッド一覧]

ruby-changes:61276

From: aycabta <ko1@a...>
Date: Sun, 17 May 2020 19:30:51 +0900 (JST)
Subject: [ruby-changes:61276] fc2a121c7c (master): [ruby/reline] If history-size isn't numeric, it should be 500

https://git.ruby-lang.org/ruby.git/commit/?id=fc2a121c7c

From fc2a121c7c56ec29cddc426910aa1ac4cd3f5edc Mon Sep 17 00:00:00 2001
From: aycabta <aycabta@g...>
Date: Sun, 3 May 2020 14:36:33 +0900
Subject: [ruby/reline] If history-size isn't numeric, it should be 500

https://tiswww.case.edu/php/chet/readline/readline.html#IDX25

> If an attempt is made to set history-size to a non-numeric value, the maximum
> number of history entries will be set to 500.

https://github.com/ruby/reline/commit/acf0437280

diff --git a/lib/reline/config.rb b/lib/reline/config.rb
index deca11f..206be5b 100644
--- a/lib/reline/config.rb
+++ b/lib/reline/config.rb
@@ -210,7 +210,11 @@ class Reline::Config https://github.com/ruby/ruby/blob/trunk/lib/reline/config.rb#L210
   def bind_variable(name, value)
     case name
     when 'history-size'
-      @history_size = value.to_i
+      begin
+        @history_size = Integer(value)
+      rescue ArgumentError
+        @history_size = 500
+      end
     when 'bell-style'
       @bell_style =
         case value
-- 
cgit v0.10.2


--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]