summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--ChangeLog5
-rw-r--r--lib/irb/completion.rb40
2 files changed, 24 insertions, 21 deletions
diff --git a/ChangeLog b/ChangeLog
index 6ce105fdc7..e88b892f55 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -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>
* ext/objspace/objspace.c: improve wording and remove duplicated comment.
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|