class Moogle::Commands::DestroyTarget
Public Instance Methods
call()
click to toggle source
# File lib/moogle/commands/destroy_target.rb, line 16 def call target_model = opts :target_model, Moogle::Target event_class = opts :event_class, Moogle::Events::TargetDestroyed target_id = request.target_id target = target_model.get target_id # We only attempt to destroy the link if it exists. # We raise an error if we are unable to destroy an existing link. raise 'Unable to destroy target' unless target.destroy if target return event_class.new( request.create_child_uuids.merge(target_id: target_id)) rescue => e e.extend Moogle::Error raise e end