Class: Convert2Ascii::TerminalPlayer
- Inherits:
-
Object
- Object
- Convert2Ascii::TerminalPlayer
- Defined in:
- lib/convert2ascii/terminal-player.rb
Constant Summary collapse
- SAFE_SLOW_DELTA =
seconds
0.9
- SAFE_FAST_DELTA =
seconds
0.2
Instance Attribute Summary collapse
-
#debug ⇒ Object
Returns the value of attribute debug.
-
#play_loop ⇒ Object
Returns the value of attribute play_loop.
-
#step_duration ⇒ Object
Returns the value of attribute step_duration.
Instance Method Summary collapse
-
#initialize(**args) ⇒ TerminalPlayer
constructor
A new instance of TerminalPlayer.
- #play ⇒ Object
Constructor Details
#initialize(**args) ⇒ TerminalPlayer
Returns a new instance of TerminalPlayer.
11 12 13 14 15 16 17 18 19 20 21 22 23 |
# File 'lib/convert2ascii/terminal-player.rb', line 11 def initialize(**args) @debug = false @audio = args[:audio] @frames = args[:frames] @play_loop = args[:play_loop] @step_duration = args[:step_duration] @total_duration = @frames.length * @step_duration @first_frame = true @backspace_adjust = "\033[A" * (@frames.length + 1) regist_hook end |
Instance Attribute Details
#debug ⇒ Object
Returns the value of attribute debug.
10 11 12 |
# File 'lib/convert2ascii/terminal-player.rb', line 10 def debug @debug end |
#play_loop ⇒ Object
Returns the value of attribute play_loop.
10 11 12 |
# File 'lib/convert2ascii/terminal-player.rb', line 10 def play_loop @play_loop end |
#step_duration ⇒ Object
Returns the value of attribute step_duration.
10 11 12 |
# File 'lib/convert2ascii/terminal-player.rb', line 10 def step_duration @step_duration end |
Instance Method Details
#play ⇒ Object
25 26 27 28 29 30 31 32 33 34 |
# File 'lib/convert2ascii/terminal-player.rb', line 25 def play begin init_screen render rescue => error raise error ensure clean_up end end |