ruby-changes:59756
From: Lars <ko1@a...>
Date: Mon, 20 Jan 2020 20:16:06 +0900 (JST)
Subject: [ruby-changes:59756] f451bb5406 (master): [ruby/irb] Fix compatibility with rails before 5.2
https://git.ruby-lang.org/ruby.git/commit/?id=f451bb5406 From f451bb5406878e1ac9ce9d37952f171837d0cb09 Mon Sep 17 00:00:00 2001 From: Lars Kanis <lars@g...> Date: Fri, 17 Jan 2020 19:30:28 +0100 Subject: [ruby/irb] Fix compatibility with rails before 5.2 Rails before 5.2 added Array#append as an alias to Array#<< , so that it expects only one argument. However ruby-2.5 added Array#append as an alias to Array#push which takes any number of arguments. If irb completion is used in `rails c` (for example "IO.<tab>") it fails with: irb/completion.rb:206:in `<<': wrong number of arguments (given 3, expected 1) (ArgumentError) Using Array#push instead of Array#append fixes compatibility. https://github.com/ruby/irb/commit/5b7bbf9c34 diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb index 3536e8e..474d13c 100644 --- a/lib/irb/completion.rb +++ b/lib/irb/completion.rb @@ -203,7 +203,7 @@ module IRB https://github.com/ruby/ruby/blob/trunk/lib/irb/completion.rb#L203 sep = $2 message = Regexp.quote($3) - gv = eval("global_variables", bind).collect{|m| m.to_s}.append("true", "false", "nil") + gv = eval("global_variables", bind).collect{|m| m.to_s}.push("true", "false", "nil") lv = eval("local_variables", bind).collect{|m| m.to_s} iv = eval("instance_variables", bind).collect{|m| m.to_s} cv = eval("self.class.constants", bind).collect{|m| m.to_s} -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/