* lib/irb/completion.rb: Use %w literal construction for long lists.

Patch by Dave Goodchild. [Fixes GH-299]

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@41062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
eregon 2013-06-04 14:17:17 +00:00
parent 71b6077a53
commit 5f55e23f9c
2 changed files with 24 additions and 21 deletions

View File

@ -1,3 +1,8 @@
Tue Jun 4 23:16:49 2013 Benoit Daloze <eregontp@gmail.com>
* lib/irb/completion.rb: Use %w literal construction for long lists.
Patch by Dave Goodchild. [Fixes GH-299]
Tue Jun 4 23:08:42 2013 Benoit Daloze <eregontp@gmail.com> Tue Jun 4 23:08:42 2013 Benoit Daloze <eregontp@gmail.com>
* ext/objspace/objspace.c: improve wording and remove duplicated comment. * ext/objspace/objspace.c: improve wording and remove duplicated comment.

View File

@ -15,24 +15,24 @@ module IRB
# Set of reserved words used by Ruby, you should not use these for # Set of reserved words used by Ruby, you should not use these for
# constants or variables # constants or variables
ReservedWords = [ ReservedWords = %w[
"BEGIN", "END", BEGIN END
"alias", "and", alias and
"begin", "break", begin break
"case", "class", case class
"def", "defined", "do", def defined do
"else", "elsif", "end", "ensure", else elsif end ensure
"false", "for", false for
"if", "in", if in
"module", module
"next", "nil", "not", next nil not
"or", or
"redo", "rescue", "retry", "return", redo rescue retry return
"self", "super", self super
"then", "true", then true
"undef", "unless", "until", undef unless until
"when", "while", when while
"yield", yield
] ]
CompletionProc = proc { |input| CompletionProc = proc { |input|
@ -211,9 +211,7 @@ module IRB
} }
# Set of available operators in Ruby # Set of available operators in Ruby
Operators = ["%", "&", "*", "**", "+", "-", "/", Operators = %w[% & * ** + - / < << <= <=> == === =~ > >= >> [] []= ^ ! != !~]
"<", "<<", "<=", "<=>", "==", "===", "=~", ">", ">=", ">>",
"[]", "[]=", "^", "!", "!=", "!~"]
def self.select_message(receiver, message, candidates, sep = ".") def self.select_message(receiver, message, candidates, sep = ".")
candidates.grep(/^#{message}/).collect do |e| candidates.grep(/^#{message}/).collect do |e|