Module: Decidim::SpamDetection::Command
- Included in:
- BlockSpamUserCommand, ReportSpamUserCommand, SpamUserCommandAdapter
- Defined in:
- lib/decidim/spam_detection/command.rb
Defined Under Namespace
Modules: ClassMethods
Instance Attribute Summary collapse
-
#result ⇒ Object
readonly
Returns the value of attribute result.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#result ⇒ Object (readonly)
Returns the value of attribute result.
8 9 10 |
# File 'lib/decidim/spam_detection/command.rb', line 8 def result @result end |
Class Method Details
.prepended(base) ⇒ Object
16 17 18 |
# File 'lib/decidim/spam_detection/command.rb', line 16 def self.prepended(base) base.extend ClassMethods end |
Instance Method Details
#call ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/decidim/spam_detection/command.rb', line 20 def call raise NotImplementedError unless defined?(super) @called = true @result = super self end |
#errors ⇒ Object
37 38 39 40 41 |
# File 'lib/decidim/spam_detection/command.rb', line 37 def errors return super if defined?(super) @errors ||= Decidim::SpamDetection::CommandErrors.new end |
#failure? ⇒ Boolean
33 34 35 |
# File 'lib/decidim/spam_detection/command.rb', line 33 def failure? called? && errors.any? end |
#success? ⇒ Boolean
29 30 31 |
# File 'lib/decidim/spam_detection/command.rb', line 29 def success? called? && !failure? end |