Class: Segue::PlayerController
- Inherits:
-
Object
- Object
- Segue::PlayerController
- Defined in:
- lib/segue/player_controller.rb
Constant Summary collapse
- CROSSFADE_TRIGGER_SECONDS =
5
Instance Method Summary collapse
-
#cleanup ⇒ Object
rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity.
-
#initialize ⇒ PlayerController
constructor
A new instance of PlayerController.
-
#next ⇒ Object
An ordered chain of guard clauses - the priority between them is the point, so leave it flat rather than nesting it to please the metrics rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity.
Constructor Details
#initialize ⇒ PlayerController
Returns a new instance of PlayerController.
12 13 14 15 16 17 18 19 |
# File 'lib/segue/player_controller.rb', line 12 def initialize @player = Segue::Player.new @preferences = Segue::Preferences.new @queue = Segue::Queue.new @notifiers = Segue::Notifiers.new @track = nil @suspended = false end |
Instance Method Details
#cleanup ⇒ Object
rubocop:enable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
36 37 38 39 40 |
# File 'lib/segue/player_controller.rb', line 36 def cleanup @notifiers.track_suspended @player.fadeout @player.cleanup end |
#next ⇒ Object
An ordered chain of guard clauses - the priority between them is the point, so leave it flat rather than nesting it to please the metrics rubocop:disable Metrics/CyclomaticComplexity, Metrics/PerceivedComplexity
24 25 26 27 28 29 30 31 32 33 |
# File 'lib/segue/player_controller.rb', line 24 def next return on_play if @preferences.play? && @suspended return on_pause if @preferences.pause? && !@suspended return on_stop if @preferences.stop? && !@suspended return build if @suspended return if @track && @player. return when_auto if @preferences.continue? when_manual end |