Class: Bashy::Remove

Inherits:
Object
  • Object
show all
Defined in:
lib/bashy.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Remove

Returns a new instance of Remove.



87
88
89
90
91
92
93
94
95
96
97
98
# File 'lib/bashy.rb', line 87

def initialize(options = {})
  # Check that our directories are in tact.
  Bashy::check_and_load_config_directory
  # Loop through passed names, and remove all that we can.
  options[:names].each do |snippet|
    if Bashy.config[:snippets].include?(snippet)
      Bashy.config[:snippets].delete(snippet)
      Bashy.save_config
      FileUtils.rm(File.join(SNIPPET_PATH, snippet))
    end
  end
end