Module: Pry::Testable::Evalable

Defined in:
lib/pry/testable/evalable.rb

Instance Method Summary collapse

Instance Method Details

#pry_eval(*eval_strs) ⇒ Object



11
12
13
14
# File 'lib/pry/testable/evalable.rb', line 11

def pry_eval(*eval_strs)
  b = String === eval_strs.first ? Pry.toplevel_binding : Pry.binding_for(eval_strs.shift)
  pry_tester(b).eval(*eval_strs)
end

#pry_tester(*args, &block) ⇒ Object



2
3
4
5
6
7
8
9
# File 'lib/pry/testable/evalable.rb', line 2

def pry_tester(*args, &block)
  if args.length == 0 || args[0].is_a?(Hash)
    args.unshift(Pry.toplevel_binding)
  end
  Pry::Testable::PryTester.new(*args).tap do |t|
    t.singleton_class.class_eval(&block) if block
  end
end