Module: Pry::Testable::Utility

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

Instance Method Summary collapse

Instance Method Details

#inner_scopeObject



27
28
29
30
31
# File 'lib/pry/testable/utility.rb', line 27

def inner_scope
  catch(:inner_scope) do
    yield -> { throw(:inner_scope, self) }
  end
end

#temp_file(ext = '.rb') {|file| ... } ⇒ void

This method returns an undefined value.

Creates a Tempfile then unlinks it after the block has yielded.

Yield Parameters:

  • file (String)

    The path of the temp file



16
17
18
19
20
21
# File 'lib/pry/testable/utility.rb', line 16

def temp_file(ext = '.rb')
  file = Tempfile.open(['pry', ext])
  yield file
ensure
  file.close(true) if file
end

#unindent(*args) ⇒ Object



23
24
25
# File 'lib/pry/testable/utility.rb', line 23

def unindent(*args)
  Pry::Helpers::CommandHelpers.unindent(*args)
end