Class: Hearken::Console

Inherits:
Object
  • Object
show all
Includes:
ShellShock::Context
Defined in:
lib/hearken/console.rb

Instance Method Summary collapse

Constructor Details

#initializeConsole

Returns a new instance of Console.



22
23
24
25
26
27
28
29
30
31
32
# File 'lib/hearken/console.rb', line 22

def initialize
  preferences = Preferences.new
  @player = Player.new preferences
  at_exit { @player.stop }
  @prompt = "hearken > "
  with :status, "'"
  with :restart, 'next'
  with :list, 'ls'
  with :enqueue, '+'
  with_all *%w{reload search start stop scrobbling shuffle setup_scrobbling recent flush}
end

Instance Method Details

#with(name, *aliases) ⇒ Object



13
14
15
16
# File 'lib/hearken/console.rb', line 13

def with name, *aliases
  aliases << name.to_s if aliases.empty?
  add_command Command.load(name, @player), *aliases
end

#with_all(*names) ⇒ Object



18
19
20
# File 'lib/hearken/console.rb', line 18

def with_all *names
  names.each {|name| with name}
end