Class: Spinna::MusicLibrary

Inherits:
Object
  • Object
show all
Defined in:
lib/spinna/music_library.rb

Overview

This class encapsulates the access to the music library.

Instance Method Summary collapse

Constructor Details

#initialize(config, history) ⇒ MusicLibrary

Returns a new instance of MusicLibrary.



4
5
6
7
# File 'lib/spinna/music_library.rb', line 4

def initialize(config, history)
  @config = config
  @history = history
end

Instance Method Details

#pickable_albums(pattern = nil) ⇒ Object

Returns the albums that are pickable. An album is pickable if it isn’t present in the history log. If a pattern is given, then only the albums that match the pattern will be returned.



12
13
14
15
# File 'lib/spinna/music_library.rb', line 12

def pickable_albums(pattern = nil)
  return available_albums unless pattern
  available_albums.select! { |a| a =~ Regexp.new(pattern)}
end