Class: Gitlab::Spamcheck::Result
- Inherits:
-
Object
- Object
- Gitlab::Spamcheck::Result
- Includes:
- Spam::SpamConstants
- Defined in:
- lib/gitlab/spamcheck/result.rb
Constant Summary collapse
- VERDICT_MAPPING =
{ ::Spamcheck::SpamVerdict::Verdict::ALLOW => ALLOW, ::Spamcheck::SpamVerdict::Verdict::CONDITIONAL_ALLOW => CONDITIONAL_ALLOW, ::Spamcheck::SpamVerdict::Verdict::DISALLOW => DISALLOW, ::Spamcheck::SpamVerdict::Verdict::BLOCK => BLOCK_USER, ::Spamcheck::SpamVerdict::Verdict::NOOP => NOOP }.freeze
Constants included from Spam::SpamConstants
Spam::SpamConstants::ALLOW, Spam::SpamConstants::BLOCK_USER, Spam::SpamConstants::CONDITIONAL_ALLOW, Spam::SpamConstants::DISALLOW, Spam::SpamConstants::ERROR_TYPE, Spam::SpamConstants::NOOP, Spam::SpamConstants::OVERRIDE_VIA_ALLOW_POSSIBLE_SPAM, Spam::SpamConstants::SUPPORTED_VERDICTS
Instance Attribute Summary collapse
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
- #evaluated? ⇒ Boolean
-
#initialize(response) ⇒ Result
constructor
A new instance of Result.
- #score ⇒ Object
- #verdict ⇒ Object
Constructor Details
#initialize(response) ⇒ Result
Returns a new instance of Result.
17 18 19 |
# File 'lib/gitlab/spamcheck/result.rb', line 17 def initialize(response) @response = response end |
Instance Attribute Details
#response ⇒ Object (readonly)
Returns the value of attribute response.
7 8 9 |
# File 'lib/gitlab/spamcheck/result.rb', line 7 def response @response end |
Instance Method Details
#evaluated? ⇒ Boolean
29 30 31 |
# File 'lib/gitlab/spamcheck/result.rb', line 29 def evaluated? response.evaluated end |
#score ⇒ Object
21 22 23 |
# File 'lib/gitlab/spamcheck/result.rb', line 21 def score response.score end |
#verdict ⇒ Object
25 26 27 |
# File 'lib/gitlab/spamcheck/result.rb', line 25 def verdict VERDICT_MAPPING.fetch(::Spamcheck::SpamVerdict::Verdict.resolve(response.verdict), ALLOW) end |