1
0
Fork 0
mirror of https://github.com/pry/pry.git synced 2022-11-09 12:35:05 -05:00
pry--pry/lib/pry/testable/evalable.rb
Kyrylo Silin 4956376f13 rubocop: fix offences of the Metrics/LineLength cop
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:
2019-03-03 17:37:58 +02:00

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