Class: SimulatorRecorder
- Inherits:
-
Object
- Object
- SimulatorRecorder
- Defined in:
- lib/capa/simulator_recorder.rb
Instance Method Summary collapse
-
#initialize(filename: '') ⇒ SimulatorRecorder
constructor
A new instance of SimulatorRecorder.
- #record ⇒ Object
Constructor Details
#initialize(filename: '') ⇒ SimulatorRecorder
Returns a new instance of SimulatorRecorder.
4 5 6 7 |
# File 'lib/capa/simulator_recorder.rb', line 4 def initialize(filename: '') abort('Please provide a name for the video') if filename.blank? @filename = filename end |
Instance Method Details
#record ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/capa/simulator_recorder.rb', line 9 def record abort unless can_record? Signal.trap("SIGINT") { raise Capa::UserAbort } Signal.trap("SIGTSTP") { raise Capa::UserAbort } Thread.new do `xcrun simctl io booted recordVideo #{@filename}` end puts 'Capturing video... Press ENTER to save' p = gets.chomp `killall -SIGINT simctl` end |