Skip to content

Instantly share code, notes, and snippets.

@tarui
Created December 5, 2012 16:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tarui/4216894 to your computer and use it in GitHub Desktop.
Save tarui/4216894 to your computer and use it in GitHub Desktop.
Index: lib/irb/completion.rb
===================================================================
--- lib/irb/completion.rb (revision 38221)
+++ lib/irb/completion.rb (working copy)
@@ -152,9 +152,10 @@
gv = eval("global_variables", bind).collect{|m| m.to_s}
lv = eval("local_variables", bind).collect{|m| m.to_s}
+ iv = eval("instance_variables", bind).collect{|m| m.to_s}
cv = eval("self.class.constants", bind).collect{|m| m.to_s}
- if (gv | lv | cv).include?(receiver) or /^[A-Z]/ =~ receiver && /\./ !~ receiver
+ if (gv | lv | iv | cv).include?(receiver) or /^[A-Z]/ =~ receiver && /\./ !~ receiver
# foo.func and foo is var. OR
# foo::func and foo is var. OR
# foo::Const and foo is var. OR
@@ -201,7 +202,7 @@
select_message(receiver, message, candidates)
else
- candidates = eval("methods | private_methods | local_variables | self.class.constants", bind).collect{|m| m.to_s}
+ candidates = eval("methods | private_methods | local_variables | instance_variables | self.class.constants", bind).collect{|m| m.to_s}
(candidates|ReservedWords).grep(/^#{Regexp.quote(input)}/)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment