mirror of
https://github.com/pry/pry.git
synced 2022-11-09 12:35:05 -05:00
4956376f13
I realise that some code might be less readable now, but now that we set a good default limit, we protect the codebase from further mess. It's important to do this to prevent adding more mess to already messy code that we have. :doctor:
22 lines
556 B
Ruby
22 lines
556 B
Ruby
class Pry
|
|
module Testable
|
|
module Evalable
|
|
def pry_tester(*args, &block)
|
|
args.unshift(Pry.toplevel_binding) if args.empty? || args[0].is_a?(Hash)
|
|
Pry::Testable::PryTester.new(*args).tap do |t|
|
|
t.singleton_class.class_eval(&block) if block
|
|
end
|
|
end
|
|
|
|
def pry_eval(*eval_strs)
|
|
b =
|
|
if String === eval_strs.first
|
|
Pry.toplevel_binding
|
|
else
|
|
Pry.binding_for(eval_strs.shift)
|
|
end
|
|
pry_tester(b).eval(*eval_strs)
|
|
end
|
|
end
|
|
end
|
|
end
|