Class: ServerStatus::Commands::Remove
- Inherits:
-
BaseCommand
- Object
- BaseCommand
- ServerStatus::Commands::Remove
- Defined in:
- lib/server-status/commands/remove.rb
Instance Attribute Summary
Attributes inherited from BaseCommand
Instance Method Summary collapse
-
#initialize(config, name) ⇒ Remove
constructor
A new instance of Remove.
- #perform ⇒ Object
Methods inherited from BaseCommand
Constructor Details
#initialize(config, name) ⇒ Remove
Returns a new instance of Remove.
4 5 6 7 |
# File 'lib/server-status/commands/remove.rb', line 4 def initialize(config, name) super(config) @name = name end |
Instance Method Details
#perform ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/server-status/commands/remove.rb', line 9 def perform if settings['hosts'] && settings['hosts'][@name] settings['hosts'].delete(@name) config.save puts "Removed #{@name}" return end puts "#{@name} does not exist" exit(1) end |