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.
1474 1475 1476 |
# File 'lib/warg.rb', line 1474 def insert_at @insert_at end |
Instance Method Details
#play ⇒ Object
1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 |
# File 'lib/warg.rb', line 1480 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
1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 |
# File 'lib/warg.rb', line 1503 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 |