Skip to content

Commit

Permalink
Wrap only what you need with eval.
Browse files Browse the repository at this point in the history
  • Loading branch information
osyo-manga committed Oct 1, 2022
1 parent ee33b7a commit 78ef990
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions lib/irb/completion.rb
Original file line number Diff line number Diff line change
Expand Up @@ -14,23 +14,23 @@ module InputCompletor # :nodoc:
using Module.new {
refine ::Binding do
def eval_methods
eval("::Kernel.instance_method(:methods).bind(self).call")
::Kernel.instance_method(:methods).bind(eval("self")).call
end

def eval_private_methods
eval("::Kernel.instance_method(:private_methods).bind(self).call")
::Kernel.instance_method(:private_methods).bind(eval("self")).call
end

def eval_instance_variables
eval("::Kernel.instance_method(:instance_variables).bind(self).call")
::Kernel.instance_method(:instance_variables).bind(eval("self")).call
end

def eval_global_variables
eval("::Kernel.instance_method(:global_variables).bind(self).call")
::Kernel.instance_method(:global_variables).bind(eval("self")).call
end

def eval_class_constants
eval("::Module.instance_method(:constants).bind(self.class).call")
::Module.instance_method(:constants).bind(eval("self.class")).call
end
end
}
Expand Down

0 comments on commit 78ef990

Please sign in to comment.