Skip to content

Commit

Permalink
* lib/irb/completion.rb: Use %w literal construction for long lists.
Browse files Browse the repository at this point in the history
  Patch by Dave Goodchild. [Fixes GH-299]

git-svn-id: svn ssh://ci.ruby-lang.org/ruby/trunk@41062 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
  • Loading branch information
eregon committed Jun 4, 2013
1 parent 71b6077 commit 5f55e23
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 21 deletions.
5 changes: 5 additions & 0 deletions ChangeLog
Original file line number Diff line number Diff line change
@@ -1,3 1,8 @@
Tue Jun 4 23:16:49 2013 Benoit Daloze <[email protected]>

* 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 <[email protected]>

* ext/objspace/objspace.c: improve wording and remove duplicated comment.
Expand Down
40 changes: 19 additions & 21 deletions lib/irb/completion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,24 15,24 @@ module InputCompletor # :nodoc:

# Set of reserved words used by Ruby, you should not use these for
# constants or variables
ReservedWords = [
"BEGIN", "END",
"alias", "and",
"begin", "break",
"case", "class",
"def", "defined", "do",
"else", "elsif", "end", "ensure",
"false", "for",
"if", "in",
"module",
"next", "nil", "not",
"or",
"redo", "rescue", "retry", "return",
"self", "super",
"then", "true",
"undef", "unless", "until",
"when", "while",
"yield",
ReservedWords = %w[
BEGIN END
alias and
begin break
case class
def defined do
else elsif end ensure
false for
if in
module
next nil not
or
redo rescue retry return
self super
then true
undef unless until
when while
yield
]

CompletionProc = proc { |input|
Expand Down Expand Up @@ -211,9 211,7 @@ module InputCompletor # :nodoc:
}

# Set of available operators in Ruby
Operators = ["%", "&", "*", "**", " ", "-", "/",
"<", "<<", "<=", "<=>", "==", "===", "=~", ">", ">=", ">>",
"[]", "[]=", "^", "!", "!=", "!~"]
Operators = %w[% & * ** - / < << <= <=> == === =~ > >= >> [] []= ^ ! != !~]

def self.select_message(receiver, message, candidates, sep = ".")
candidates.grep(/^#{message}/).collect do |e|
Expand Down

0 comments on commit 5f55e23

Please sign in to comment.