Class: Fav::RemoveCommand
- Inherits:
-
WritableCommand
- Object
- FavCommand
- WritableCommand
- Fav::RemoveCommand
- Defined in:
- lib/fav.rb
Overview
A command to remove a fav
Instance Attribute Summary
Attributes inherited from FavCommand
#cli_options, #command_args, #command_name, #command_options, #config, #favs_file
Instance Method Summary collapse
-
#on_group(group) ⇒ Object
Remove a grouped fav.
-
#on_non_group ⇒ Object
Remove a non-grouped fav.
Methods inherited from WritableCommand
Methods inherited from FavCommand
#initialize, #post_group, #run!
Constructor Details
This class inherits a constructor from Fav::FavCommand
Instance Method Details
#on_group(group) ⇒ Object
Remove a grouped fav
167 168 169 170 171 172 |
# File 'lib/fav.rb', line 167 def on_group(group) #raise error if command they are attempting to remove doesn't exist raise "Can not remove command because it doesn't exist" unless self.config[group][self.command_name] self.config[group].delete(self.command_name) info "Successfully removed #{self.command_name} from the '#{group}' group!" end |
#on_non_group ⇒ Object
Remove a non-grouped fav
175 176 177 178 |
# File 'lib/fav.rb', line 175 def on_non_group self.config.params.delete(self.command_name) info "Successfully removed #{self.command_name}" end |