Class: Decidim::Admin::DestroyFeature

Inherits:
Rectify::Command
  • Object
show all
Defined in:
decidim-admin/app/commands/decidim/admin/destroy_feature.rb

Overview

This command deals with destroying a Feature from the admin panel.

Instance Method Summary collapse

Constructor Details

#initialize(feature) ⇒ DestroyFeature

Public: Initializes the command.

feature - The Feature to be destroyed.



10
11
12
# File 'decidim-admin/app/commands/decidim/admin/destroy_feature.rb', line 10

def initialize(feature)
  @feature = feature
end

Instance Method Details

#callObject

Public: Executes the command.

Broadcasts :ok if it got destroyed, raises an exception otherwise.



17
18
19
20
21
22
23
24
# File 'decidim-admin/app/commands/decidim/admin/destroy_feature.rb', line 17

def call
  begin
    destroy_feature
  rescue StandardError
    return broadcast(:invalid)
  end
  broadcast(:ok)
end