Class: Warg::Playlist
- Inherits:
-
Object
- Object
- Warg::Playlist
- Defined in:
- lib/warg.rb
Defined Under Namespace
Classes: Start
Instance Attribute Summary collapse
-
#insert_at ⇒ Object
readonly
Returns the value of attribute insert_at.
Instance Method Summary collapse
-
#initialize ⇒ Playlist
constructor
A new instance of Playlist.
- #play ⇒ Object
- #queue(command_step) ⇒ Object
Constructor Details
Instance Attribute Details
#insert_at ⇒ Object (readonly)
Returns the value of attribute insert_at.
1385 1386 1387 |
# File 'lib/warg.rb', line 1385 def insert_at @insert_at end |
Instance Method Details
#play ⇒ Object
1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 |
# File 'lib/warg.rb', line 1391 def play = @insert_at = @start command = nil while .next = @insert_at = .next if command != .command command = .command Warg.console.puts Console::SGR(command.command_name.console).with(text_color: :blue, effect: :bold) end Warg.console.puts Console::SGR(" -> #{.}").with(text_color: :magenta) result = .run if result.failed? command.on_failure(result) end end end |
#queue(command_step) ⇒ Object
1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 |
# File 'lib/warg.rb', line 1414 def queue(command_step) if @insert_at.next command_step.next = @insert_at.next end command_step.previous = @insert_at @insert_at.next = command_step @insert_at = command_step end |