Class: Fav::AddCommand

Inherits:
WritableCommand show all
Defined in:
lib/fav.rb

Overview

A command to add a Fav

Instance Attribute Summary

Attributes inherited from FavCommand

#cli_options, #command_args, #command_name, #command_options, #config, #favs_file

Instance Method Summary collapse

Methods inherited from WritableCommand

#post_group

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

Add a grouped fav



152
153
154
155
# File 'lib/fav.rb', line 152

def on_group(group)
  self.config.add_to_group(group, self.command_name, self.cli_options[:add])
  info "Successfully added #{self.command_name} to the '#{group}' group!"
end

#on_non_groupObject

Add a non-grouped fav



158
159
160
161
# File 'lib/fav.rb', line 158

def on_non_group
  self.config.add(self.command_name, self.cli_options[:add])
  info "Successfully added #{self.command_name}!"
end