Top Level Namespace

Defined Under Namespace

Modules: PryTestHelpers Classes: BasicObject, Object, Pry, PryTester

Instance Method Summary collapse

Instance Method Details

#pry_eval(*eval_strs) ⇒ Object



87
88
89
90
91
92
93
94
95
# File 'lib/pry/test/helper.rb', line 87

def pry_eval(*eval_strs)
  if eval_strs.first.is_a? String
    binding = Pry.toplevel_binding
  else
    binding = Pry.binding_for(eval_strs.shift)
  end

  pry_tester(binding).eval(*eval_strs)
end

#pry_tester(*args, &block) ⇒ Object



77
78
79
80
81
82
83
84
85
# File 'lib/pry/test/helper.rb', line 77

def pry_tester(*args, &block)
  if args.length == 0 || args[0].is_a?(Hash)
    args.unshift(Pry.toplevel_binding)
  end

  PryTester.new(*args).tap do |t|
    (class << t; self; end).class_eval(&block) if block
  end
end