Module: Pry::Testable::Utility

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

Instance Method Summary collapse

Instance Method Details

#inner_scopeObject



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

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

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

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



10
11
12
13
14
15
# File 'lib/pry/testable/utility.rb', line 10

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

#unindent(*args) ⇒ Object



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

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