Class: Decidim::DecidimAwesome::Admin::DestroyConstraint
- Inherits:
-
Rectify::Command
- Object
- Rectify::Command
- Decidim::DecidimAwesome::Admin::DestroyConstraint
- Defined in:
- app/commands/decidim/decidim_awesome/admin/destroy_constraint.rb
Instance Attribute Summary collapse
-
#constraint ⇒ Object
readonly
Returns the value of attribute constraint.
Instance Method Summary collapse
-
#call ⇒ Object
Executes the command.
-
#initialize(constraint) ⇒ DestroyConstraint
constructor
Public: Initializes the command.
Constructor Details
#initialize(constraint) ⇒ DestroyConstraint
Public: Initializes the command.
constraint - A constraint constraint
10 11 12 |
# File 'app/commands/decidim/decidim_awesome/admin/destroy_constraint.rb', line 10 def initialize(constraint) @constraint = constraint end |
Instance Attribute Details
#constraint ⇒ Object (readonly)
Returns the value of attribute constraint.
27 28 29 |
# File 'app/commands/decidim/decidim_awesome/admin/destroy_constraint.rb', line 27 def constraint @constraint end |
Instance Method Details
#call ⇒ Object
Executes the command. Broadcasts these events:
-
:ok when everything is valid.
-
:invalid if we couldn’t proceed.
Returns nothing.
20 21 22 23 24 25 |
# File 'app/commands/decidim/decidim_awesome/admin/destroy_constraint.rb', line 20 def call constraint.destroy! broadcast(:ok) rescue StandardError => e broadcast(:invalid, e.) end |