Class: Siftly::Result
- Inherits:
-
Object
- Object
- Siftly::Result
- Defined in:
- lib/siftly/result.rb
Instance Attribute Summary collapse
-
#aggregator ⇒ Object
readonly
Returns the value of attribute aggregator.
-
#attribute ⇒ Object
readonly
Returns the value of attribute attribute.
-
#filter_results ⇒ Object
readonly
Returns the value of attribute filter_results.
-
#reasons ⇒ Object
readonly
Returns the value of attribute reasons.
-
#score ⇒ Object
readonly
Returns the value of attribute score.
-
#threshold ⇒ Object
readonly
Returns the value of attribute threshold.
-
#value_preview ⇒ Object
readonly
Returns the value of attribute value_preview.
Instance Method Summary collapse
- #errors ⇒ Object
-
#initialize(spam:, score:, filter_results:, reasons:, attribute:, value_preview:, threshold:, aggregator:) ⇒ Result
constructor
A new instance of Result.
- #matches ⇒ Object
- #spam? ⇒ Boolean
Constructor Details
#initialize(spam:, score:, filter_results:, reasons:, attribute:, value_preview:, threshold:, aggregator:) ⇒ Result
Returns a new instance of Result.
7 8 9 10 11 12 13 14 15 16 |
# File 'lib/siftly/result.rb', line 7 def initialize(spam:, score:, filter_results:, reasons:, attribute:, value_preview:, threshold:, aggregator:) @spam = spam @score = score.to_f @filter_results = filter_results.dup.freeze @reasons = reasons.compact.freeze @attribute = attribute @value_preview = value_preview @threshold = threshold @aggregator = aggregator end |
Instance Attribute Details
#aggregator ⇒ Object (readonly)
Returns the value of attribute aggregator.
5 6 7 |
# File 'lib/siftly/result.rb', line 5 def aggregator @aggregator end |
#attribute ⇒ Object (readonly)
Returns the value of attribute attribute.
5 6 7 |
# File 'lib/siftly/result.rb', line 5 def attribute @attribute end |
#filter_results ⇒ Object (readonly)
Returns the value of attribute filter_results.
5 6 7 |
# File 'lib/siftly/result.rb', line 5 def filter_results @filter_results end |
#reasons ⇒ Object (readonly)
Returns the value of attribute reasons.
5 6 7 |
# File 'lib/siftly/result.rb', line 5 def reasons @reasons end |
#score ⇒ Object (readonly)
Returns the value of attribute score.
5 6 7 |
# File 'lib/siftly/result.rb', line 5 def score @score end |
#threshold ⇒ Object (readonly)
Returns the value of attribute threshold.
5 6 7 |
# File 'lib/siftly/result.rb', line 5 def threshold @threshold end |
#value_preview ⇒ Object (readonly)
Returns the value of attribute value_preview.
5 6 7 |
# File 'lib/siftly/result.rb', line 5 def value_preview @value_preview end |
Instance Method Details
#errors ⇒ Object
26 27 28 |
# File 'lib/siftly/result.rb', line 26 def errors filter_results.select(&:error?) end |
#matches ⇒ Object
22 23 24 |
# File 'lib/siftly/result.rb', line 22 def matches filter_results.select(&:matched?) end |
#spam? ⇒ Boolean
18 19 20 |
# File 'lib/siftly/result.rb', line 18 def spam? @spam end |