class Linguin::BulkProfanityDetection
Linguin::BulkProfanityDetection
¶ ↑
Returned by Linguin#detect_profanity(!) when called with an array of strings.
success?
- Bool - checks if detection results were found error
- Hash - contains `error` and `message` about what went wrong results - Array - contains the profanity scores of each text in the same order
Attributes
scores[RW]
success[W]
Public Class Methods
error(code, message)
click to toggle source
# File lib/linguin/bulk_profanity_detection.rb, line 15 def error(code, message) new do |detection| detection.success = false detection.error = { code: code, message: message } end end
success(result)
click to toggle source
# File lib/linguin/bulk_profanity_detection.rb, line 25 def success(result) new do |detection| detection.success = true detection.scores = result[:scores] end end
Public Instance Methods
success?()
click to toggle source
# File lib/linguin/bulk_profanity_detection.rb, line 33 def success? !!@success end