Class: IO
- Inherits:
-
Object
- Object
- IO
- Defined in:
- lib/prick/subcommand/prick-bash.rb
Class Method Summary collapse
-
.capture(&block) ⇒ Object
ChatGPT.
Class Method Details
.capture(&block) ⇒ Object
ChatGPT
4 5 6 7 8 9 10 11 12 13 14 |
# File 'lib/prick/subcommand/prick-bash.rb', line 4 def self.capture(&block) # ChatGPT block_given? or raise ArgumentError stdout = $stdout begin $stdout = StringIO.new yield $stdout.string ensure $stdout = stdout end end |