class Spinna::Client

The client takes care of initializing the application by reading the configuration and the history. It exposes the various commands that spinna can do.

Attributes

config[RW]
history[RW]
library[RW]

Public Class Methods

new() click to toggle source

Boots the application.

# File lib/spinna/client.rb, line 17
def initialize
  init_configuration
  init_history
  init_library
end

Public Instance Methods

get(opts = {}) click to toggle source

Get a certain number of random albums from the music collection.

# File lib/spinna/client.rb, line 24
def get(opts = {})
  number_of_picks = opts[:number_of_picks] || config.number_of_picks
  pattern = opts[:pattern] || nil
  Picker.new(config, history, library).pick(number_of_picks, pattern)
end

Private Instance Methods

init_configuration() click to toggle source
# File lib/spinna/client.rb, line 32
def init_configuration
  @config = Config.new
end
init_history() click to toggle source
# File lib/spinna/client.rb, line 36
def init_history
  @history = Spinna::History.new(config)
end
init_library() click to toggle source
# File lib/spinna/client.rb, line 40
def init_library
  @library = Spinna::MusicLibrary.new(config, history)
end