Class: AudioAddict::Commands::Base
- Inherits:
-
MisterBin::Command
- Object
- MisterBin::Command
- AudioAddict::Commands::Base
show all
- Defined in:
- lib/audio_addict/commands/base.rb
Instance Method Summary
collapse
Instance Method Details
#current_channel ⇒ Object
30
31
32
|
# File 'lib/audio_addict/commands/base.rb', line 30
def current_channel
@current_channel ||= radio[Config.channel]
end
|
#current_network ⇒ Object
26
27
28
|
# File 'lib/audio_addict/commands/base.rb', line 26
def current_network
Config.network
end
|
#needs(*config_keys) ⇒ Object
9
10
11
12
13
14
15
16
|
# File 'lib/audio_addict/commands/base.rb', line 9
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
34
35
36
|
# File 'lib/audio_addict/commands/base.rb', line 34
def prompt
@prompt ||= TTY::Prompt.new
end
|
#radio ⇒ Object
22
23
24
|
# File 'lib/audio_addict/commands/base.rb', line 22
def radio
@radio ||= Radio.new current_network
end
|
#require_premium_account ⇒ Object
18
19
20
|
# File 'lib/audio_addict/commands/base.rb', line 18
def require_premium_account
raise PremiumAccount unless Config.premium
end
|