Class: AppleMusicLibrary::PlaylistFolder
- Inherits:
-
Object
- Object
- AppleMusicLibrary::PlaylistFolder
- Defined in:
- lib/apple_music_library/playlist_folder.rb
Constant Summary collapse
- @@playlist_folders =
{}
Instance Attribute Summary collapse
-
#info ⇒ Object
readonly
Returns the value of attribute info.
Class Method Summary collapse
Instance Method Summary collapse
- #children ⇒ Object
- #id ⇒ Object
-
#initialize(info) ⇒ PlaylistFolder
constructor
A new instance of PlaylistFolder.
- #playlist_folders ⇒ Object
- #playlists ⇒ Object
Constructor Details
#initialize(info) ⇒ PlaylistFolder
Returns a new instance of PlaylistFolder.
10 11 12 13 14 |
# File 'lib/apple_music_library/playlist_folder.rb', line 10 def initialize(info) @info = info @@playlist_folders[id] = self end |
Instance Attribute Details
#info ⇒ Object (readonly)
Returns the value of attribute info.
6 7 8 |
# File 'lib/apple_music_library/playlist_folder.rb', line 6 def info @info end |
Class Method Details
.all ⇒ Object
16 17 18 |
# File 'lib/apple_music_library/playlist_folder.rb', line 16 def self.all @@playlist_folders.values end |
.find_by_name(playlist_folder_name) ⇒ Object
20 21 22 23 24 25 26 |
# File 'lib/apple_music_library/playlist_folder.rb', line 20 def self.find_by_name(playlist_folder_name) results = @@playlist_folders.values.select{|pf| pf.name == playlist_folder_name} if results.size == 1 return results.first end results end |
Instance Method Details
#children ⇒ Object
32 33 34 |
# File 'lib/apple_music_library/playlist_folder.rb', line 32 def children playlist_folders.concat(playlists) end |
#id ⇒ Object
28 29 30 |
# File 'lib/apple_music_library/playlist_folder.rb', line 28 def id playlist_persistent_id end |
#playlist_folders ⇒ Object
36 37 38 |
# File 'lib/apple_music_library/playlist_folder.rb', line 36 def playlist_folders @@playlist_folders.values.select{|pf| pf.parent_persistent_id == id} end |