Class: Spinna::Client

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

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeClient

Boots the application.



17
18
19
20
21
# File 'lib/spinna/client.rb', line 17

def initialize
  init_configuration
  init_history
  init_library
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



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

def config
  @config
end

#historyObject

Returns the value of attribute history.



14
15
16
# File 'lib/spinna/client.rb', line 14

def history
  @history
end

#libraryObject

Returns the value of attribute library.



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

def library
  @library
end

Instance Method Details

#get(opts = {}) ⇒ Object

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



24
25
26
27
28
# 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