diff --git a/lib/irb/completion.rb b/lib/irb/completion.rb index 7f102dcdf..45947d3f5 100644 --- a/lib/irb/completion.rb +++ b/lib/irb/completion.rb @@ -140,23 +140,23 @@ class RegexpCompletor < BaseCompletor # :nodoc: using Module.new { refine ::Binding do def eval_methods - ::Kernel.instance_method(:methods).bind(eval("self")).call + ::Kernel.instance_method(:methods).bind_call(receiver) end def eval_private_methods - ::Kernel.instance_method(:private_methods).bind(eval("self")).call + ::Kernel.instance_method(:private_methods).bind_call(receiver) end def eval_instance_variables - ::Kernel.instance_method(:instance_variables).bind(eval("self")).call + ::Kernel.instance_method(:instance_variables).bind_call(receiver) end def eval_global_variables - ::Kernel.instance_method(:global_variables).bind(eval("self")).call + ::Kernel.instance_method(:global_variables).bind_call(receiver) end def eval_class_constants - ::Module.instance_method(:constants).bind(eval("self.class")).call + ::Module.instance_method(:constants).bind_call(receiver.class) end end } diff --git a/lib/irb/workspace.rb b/lib/irb/workspace.rb index 632b43243..3843a7775 100644 --- a/lib/irb/workspace.rb +++ b/lib/irb/workspace.rb @@ -61,7 +61,7 @@ def initialize(*main) end if main.empty? - @main = eval("self", @binding) + @main = @binding.receiver else @main = main[0] end