Class: Assistant::BrainMaintenance::Summary
- Inherits:
-
Data
- Object
- Data
- Assistant::BrainMaintenance::Summary
- Defined in:
- app/services/assistant/brain_maintenance.rb
Instance Attribute Summary collapse
-
#applied ⇒ Object
readonly
Returns the value of attribute applied.
-
#error ⇒ Object
readonly
Returns the value of attribute error.
-
#pending_for_review ⇒ Object
readonly
Returns the value of attribute pending_for_review.
-
#rejected ⇒ Object
readonly
Returns the value of attribute rejected.
-
#weight_after ⇒ Object
readonly
Returns the value of attribute weight_after.
-
#weight_before ⇒ Object
readonly
Returns the value of attribute weight_before.
Instance Method Summary collapse
- #any_changes? ⇒ Boolean
-
#initialize(rejected: [], applied: [], pending_for_review: 0, weight_before: 0, weight_after: 0, error: nil) ⇒ Summary
constructor
A new instance of Summary.
- #reportable? ⇒ Boolean
- #success? ⇒ Boolean
- #tokens_saved ⇒ Object
Constructor Details
#initialize(rejected: [], applied: [], pending_for_review: 0, weight_before: 0, weight_after: 0, error: nil) ⇒ Summary
Returns a new instance of Summary.
23 24 25 |
# File 'app/services/assistant/brain_maintenance.rb', line 23 def initialize(rejected: [], applied: [], pending_for_review: 0, weight_before: 0, weight_after: 0, error: nil) super end |
Instance Attribute Details
#applied ⇒ Object (readonly)
Returns the value of attribute applied
22 23 24 |
# File 'app/services/assistant/brain_maintenance.rb', line 22 def applied @applied end |
#error ⇒ Object (readonly)
Returns the value of attribute error
22 23 24 |
# File 'app/services/assistant/brain_maintenance.rb', line 22 def error @error end |
#pending_for_review ⇒ Object (readonly)
Returns the value of attribute pending_for_review
22 23 24 |
# File 'app/services/assistant/brain_maintenance.rb', line 22 def pending_for_review @pending_for_review end |
#rejected ⇒ Object (readonly)
Returns the value of attribute rejected
22 23 24 |
# File 'app/services/assistant/brain_maintenance.rb', line 22 def rejected @rejected end |
#weight_after ⇒ Object (readonly)
Returns the value of attribute weight_after
22 23 24 |
# File 'app/services/assistant/brain_maintenance.rb', line 22 def weight_after @weight_after end |
#weight_before ⇒ Object (readonly)
Returns the value of attribute weight_before
22 23 24 |
# File 'app/services/assistant/brain_maintenance.rb', line 22 def weight_before @weight_before end |
Instance Method Details
#any_changes? ⇒ Boolean
28 |
# File 'app/services/assistant/brain_maintenance.rb', line 28 def any_changes? = rejected.any? || applied.any? |
#reportable? ⇒ Boolean
29 |
# File 'app/services/assistant/brain_maintenance.rb', line 29 def reportable? = any_changes? || pending_for_review.positive? |
#success? ⇒ Boolean
27 |
# File 'app/services/assistant/brain_maintenance.rb', line 27 def success? = error.nil? |
#tokens_saved ⇒ Object
30 |
# File 'app/services/assistant/brain_maintenance.rb', line 30 def tokens_saved = [weight_before - weight_after, 0].max |