Module: Pry::Testable::Utility

Defined in:
lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/testable/utility.rb

Instance Method Summary collapse

Instance Method Details

#inner_scopeObject



27
28
29
30
31
# File 'lib/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/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/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/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/rubypitaya/app-template/vendor/bundle/ruby/3.1.0/gems/pry-0.14.2/lib/pry/testable/utility.rb', line 23

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