Class: Decidim::Notify::Admin::DestroyChapter

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(chapter) ⇒ DestroyChapter

Public: Initializes the command.

chapter - the chapter to be update



10
11
12
# File 'app/commands/decidim/notify/admin/destroy_chapter.rb', line 10

def initialize(chapter)
  @chapter = chapter
end

Instance Attribute Details

#chapterObject (readonly)

Returns the value of attribute chapter.



26
27
28
# File 'app/commands/decidim/notify/admin/destroy_chapter.rb', line 26

def chapter
  @chapter
end

Instance Method Details

#callObject

Executes the command. Broadcasts these events:

  • :ok when everything is valid.

  • :invalid if we couldn’t proceed.

Returns nothing.



20
21
22
23
24
# File 'app/commands/decidim/notify/admin/destroy_chapter.rb', line 20

def call
  chapter.destroy!

  broadcast(:ok)
end