Class: Radiodan::PlaylistSync
- Inherits:
-
Object
- Object
- Radiodan::PlaylistSync
- Includes:
- Logging
- Defined in:
- lib/radiodan/playlist_sync.rb
Defined Under Namespace
Classes: SyncError
Instance Attribute Summary collapse
-
#current ⇒ Object
Returns the value of attribute current.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#expected ⇒ Object
Returns the value of attribute expected.
Instance Method Summary collapse
-
#initialize(expected = nil, current = nil) ⇒ PlaylistSync
constructor
A new instance of PlaylistSync.
- #ready? ⇒ Boolean
- #sync? ⇒ Boolean
Methods included from Logging
included, level, level=, #logger, output, output=
Constructor Details
#initialize(expected = nil, current = nil) ⇒ PlaylistSync
Returns a new instance of PlaylistSync.
11 12 13 14 15 |
# File 'lib/radiodan/playlist_sync.rb', line 11 def initialize(expected = nil, current = nil) @expected = expected @current = current @errors = [] end |
Instance Attribute Details
#current ⇒ Object
Returns the value of attribute current.
8 9 10 |
# File 'lib/radiodan/playlist_sync.rb', line 8 def current @current end |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
9 10 11 |
# File 'lib/radiodan/playlist_sync.rb', line 9 def errors @errors end |
#expected ⇒ Object
Returns the value of attribute expected.
8 9 10 |
# File 'lib/radiodan/playlist_sync.rb', line 8 def expected @expected end |
Instance Method Details
#ready? ⇒ Boolean
23 24 25 26 27 28 29 30 |
# File 'lib/radiodan/playlist_sync.rb', line 23 def ready? if expected.nil? || current.nil? logger.warn 'Require two playlists to compare' false else true end end |
#sync? ⇒ Boolean
17 18 19 20 21 |
# File 'lib/radiodan/playlist_sync.rb', line 17 def sync? if ready? compare_playback_state & compare_playback_mode & compare_tracks & compare_volume end end |