class Writefully::Tools::Eraser
Public Instance Methods
destroy()
click to toggle source
# File lib/writefully/tools/eraser.rb, line 26 def destroy compute_type.by_site(site_id).where(slug: content.slug).first.destroy end
directory_exists?()
click to toggle source
# File lib/writefully/tools/eraser.rb, line 30 def directory_exists? File.directory?(File.join(Writefully.options[:content], index[:site], index[:resource], index[:slug])) end
remove_assets()
click to toggle source
# File lib/writefully/tools/eraser.rb, line 18 def remove_assets Writefully::Storage.directory.files.map do |file| file.key if file.key.match(::Regexp.new(index[:slug])) end.compact.each do |key| Celluloid::Actor[:pigeons].future.remove(key) end end
trash()
click to toggle source
# File lib/writefully/tools/eraser.rb, line 12 def trash compute_type.by_site(site_id) .where(slug: content.slug) .first.update_attributes(trashed: true) end
use()
click to toggle source
# File lib/writefully/tools/eraser.rb, line 5 def use trash remove_assets destroyed = future.destroy terminate if destroyed.value end