Class: Spinna::Client
- Inherits:
-
Object
- Object
- Spinna::Client
- 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
-
#config ⇒ Object
Returns the value of attribute config.
-
#history ⇒ Object
Returns the value of attribute history.
-
#library ⇒ Object
Returns the value of attribute library.
Instance Method Summary collapse
-
#get(opts = {}) ⇒ Object
Get a certain number of random albums from the music collection.
-
#initialize ⇒ Client
constructor
Boots the application.
Constructor Details
#initialize ⇒ Client
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
#config ⇒ Object
Returns the value of attribute config.
13 14 15 |
# File 'lib/spinna/client.rb', line 13 def config @config end |
#history ⇒ Object
Returns the value of attribute history.
14 15 16 |
# File 'lib/spinna/client.rb', line 14 def history @history end |
#library ⇒ Object
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 |