Class: Moogle::Commands::DestroyLink
- Inherits:
-
Object
- Object
- Moogle::Commands::DestroyLink
- Includes:
- Serf::Command
- Defined in:
- lib/moogle/commands/destroy_link.rb
Instance Method Summary collapse
Instance Method Details
#call ⇒ Object
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# 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 |