Class: Sonice::App

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/sonice/app.rb

Overview

Sinatra application

Instance Method Summary collapse

Constructor Details

#initializeApp

Returns a new instance of App.



17
18
19
# File 'lib/sonice/app.rb', line 17

def initialize
  @player = player
end

Instance Method Details

#playerObject



21
22
23
24
25
26
27
28
29
# File 'lib/sonice/app.rb', line 21

def player
  @player ||= begin
    puts "Looking for a player..."
    player = Anyplayer::Selector.new.player
    abort "Error: no music player launched!" unless player
    puts "Connected to #{player.name}"
    player
  end
end