Class: AudioAddict::Commands::Base
- Inherits:
-
MisterBin::Command
- Object
- MisterBin::Command
- AudioAddict::Commands::Base
show all
- Defined in:
- lib/audio_addict/commands/base.rb
Direct Known Subclasses
APICmd, ChannelsCmd, ConfigCmd, DownloadCmd, HistoryCmd, LogCmd, LoginCmd, NowCmd, PlaylistCmd, SetCmd, VoteCmd
Instance Method Summary
collapse
Instance Method Details
#current_channel ⇒ Object
29
30
31
|
# File 'lib/audio_addict/commands/base.rb', line 29
def current_channel
@current_channel ||= radio[Config.channel]
end
|
#current_network ⇒ Object
25
26
27
|
# File 'lib/audio_addict/commands/base.rb', line 25
def current_network
Config.network
end
|
#needs(*config_keys) ⇒ Object
8
9
10
11
12
13
14
15
|
# File 'lib/audio_addict/commands/base.rb', line 8
def needs(*config_keys)
missing = []
config_keys.each do |key|
missing.push key unless Config.has_key? key
end
raise ConfigError, missing if missing.any?
end
|
#prompt ⇒ Object
33
34
35
|
# File 'lib/audio_addict/commands/base.rb', line 33
def prompt
@prompt ||= TTY::Prompt.new
end
|
#radio ⇒ Object
21
22
23
|
# File 'lib/audio_addict/commands/base.rb', line 21
def radio
@radio ||= Radio.new current_network
end
|
#require_premium_account ⇒ Object
17
18
19
|
# File 'lib/audio_addict/commands/base.rb', line 17
def require_premium_account
raise PremiumAccount unless Config.premium
end
|