public
Created

  • Download Gist
irb_completion.patch
Diff
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25
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

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.