summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authoreregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-04 14:17:17 +0000
committereregon <eregon@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2013-06-04 14:17:17 +0000
commit5f55e23f9c2feb774aaffde8c9e20213c7b97497 (patch)
tree0d5adfc3913722f256e4c891b8007bf6b91aeccd /lib
parent71b6077a5354335f5f04b7e852a22b3290b9f528 (diff)
* 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
Diffstat (limited to 'lib')
-rw-r--r--lib/irb/completion.rb40
1 files changed, 19 insertions, 21 deletions
diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb
index 3be0610c6e..c6f8a5889f 100644
--- a/lib/irb/completion.rb
+++ b/lib/irb/completion.rb
@@ -15,24 +15,24 @@ module IRB
# 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|
@@ -211,9 +211,7 @@ module IRB
}
# Set of available operators in Ruby
- Operators = ["%", "&", "*", "**", "+", "-", "/",
- "<", "<<", "<=", "<=>", "==", "===", "=~", ">", ">=", ">>",
- "[]", "[]=", "^", "!", "!=", "!~"]
+ Operators = %w[% & * ** + - / < << <= <=> == === =~ > >= >> [] []= ^ ! != !~]
def self.select_message(receiver, message, candidates, sep = ".")
candidates.grep(/^#{message}/).collect do |e|