Skip to content

Commit 5b7bbf9

Browse files
committed
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.
1 parent 6b053ca commit 5b7bbf9

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

lib/irb/completion.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ def self.retrieve_completion_data(input, bind: IRB.conf[:MAIN_CONTEXT].workspace
203203
sep = $2
204204
message = Regexp.quote($3)
205205

206-
gv = eval("global_variables", bind).collect{|m| m.to_s}.append("true", "false", "nil")
206+
gv = eval("global_variables", bind).collect{|m| m.to_s}.push("true", "false", "nil")
207207
lv = eval("local_variables", bind).collect{|m| m.to_s}
208208
iv = eval("instance_variables", bind).collect{|m| m.to_s}
209209
cv = eval("self.class.constants", bind).collect{|m| m.to_s}

0 commit comments

Comments
 (0)