class Moogle::Commands::DestroyLink
Public Instance Methods
call()
click to toggle source
# File lib/moogle/commands/destroy_link.rb, line 16 def call link_model = opts :link_model, Moogle::Link event_class = opts :event_class, Moogle::Events::LinkDestroyed link_id = request.link_id link = link_model.get link_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 link' unless link.destroy if link return event_class.new( request.create_child_uuids.merge(link_id: link_id)) rescue => e e.extend Moogle::Error raise e end