Class: Snippit::CLI::Delete
- Inherits:
-
Object
- Object
- Snippit::CLI::Delete
- Includes:
- IO
- Defined in:
- lib/snippit/cli/delete.rb
Overview
Snippit::CLI::Delete deletes a snippet.
Instance Method Summary collapse
-
#initialize(slug) ⇒ Delete
constructor
A new instance of Delete.
-
#start ⇒ Integer
Starts the delete subcommand.
Methods included from IO
#definitions, #definitions_file, #delete_snippet, #filepath!, #read_snippet, #snippit_dir, #snippit_dir!, #write_definition, #write_snippet
Constructor Details
#initialize(slug) ⇒ Delete
Returns a new instance of Delete.
11 12 13 |
# File 'lib/snippit/cli/delete.rb', line 11 def initialize(slug) @slug = slug end |
Instance Method Details
#start ⇒ Integer
Starts the delete subcommand.
18 19 20 21 22 23 |
# File 'lib/snippit/cli/delete.rb', line 18 def start return 1 unless definitions.key?(@slug) delete_snippet(@slug) 0 end |