Class: Decidim::SpamSignal::Admin::RemoveScannerCommand
- Inherits:
-
Command
- Object
- Rectify::Command
- Command
- Decidim::SpamSignal::Admin::RemoveScannerCommand
- Defined in:
- app/commands/decidim/spam_signal/admin/remove_scanner_command.rb
Instance Attribute Summary collapse
-
#current_config ⇒ Object
readonly
Returns the value of attribute current_config.
-
#key ⇒ Object
readonly
Returns the value of attribute key.
-
#settings_repo ⇒ Object
readonly
Returns the value of attribute settings_repo.
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(config, settings_repo, key) ⇒ RemoveScannerCommand
constructor
A new instance of RemoveScannerCommand.
Constructor Details
#initialize(config, settings_repo, key) ⇒ RemoveScannerCommand
Returns a new instance of RemoveScannerCommand.
11 12 13 14 15 16 17 |
# File 'app/commands/decidim/spam_signal/admin/remove_scanner_command.rb', line 11 def initialize(config, settings_repo, key) @current_config = config @settings_repo = settings_repo @key = key raise ArgumentError, "missing current_config" unless current_config raise ArgumentError, "missing settings_repo" unless settings_repo end |
Instance Attribute Details
#current_config ⇒ Object (readonly)
Returns the value of attribute current_config.
7 8 9 |
# File 'app/commands/decidim/spam_signal/admin/remove_scanner_command.rb', line 7 def current_config @current_config end |
#key ⇒ Object (readonly)
Returns the value of attribute key.
7 8 9 |
# File 'app/commands/decidim/spam_signal/admin/remove_scanner_command.rb', line 7 def key @key end |
#settings_repo ⇒ Object (readonly)
Returns the value of attribute settings_repo.
7 8 9 |
# File 'app/commands/decidim/spam_signal/admin/remove_scanner_command.rb', line 7 def settings_repo @settings_repo end |
Instance Method Details
#call ⇒ Object
19 20 21 22 23 24 25 26 27 |
# File 'app/commands/decidim/spam_signal/admin/remove_scanner_command.rb', line 19 def call begin settings_repo.rm_scan(key) current_config.save_settings broadcast(:ok, settings_repo) rescue StandardError => e broadcast(:invalid, e.) end end |