Class: Imapcli::Stats
- Inherits:
-
Object
- Object
- Imapcli::Stats
- Defined in:
- lib/imapcli/stats.rb
Overview
Handles mailbox statistics.
message_sizes is an array of message sizes in bytes.
Instance Method Summary collapse
-
#add(other_stats) ⇒ Object
Adds other statistics.
- #count ⇒ Object
-
#initialize(message_sizes = []) ⇒ Stats
constructor
A new instance of Stats.
- #max_size ⇒ Object
- #median_size ⇒ Object
- #min_size ⇒ Object
- #quartile_1_size ⇒ Object
- #quartile_3_size ⇒ Object
- #total_size ⇒ Object
Constructor Details
#initialize(message_sizes = []) ⇒ Stats
Returns a new instance of Stats.
9 10 11 |
# File 'lib/imapcli/stats.rb', line 9 def initialize( = []) = end |
Instance Method Details
#add(other_stats) ⇒ Object
Adds other statistics.
14 15 16 17 18 19 |
# File 'lib/imapcli/stats.rb', line 14 def add(other_stats) return unless other_stats += other_stats. invalidate end |
#count ⇒ Object
21 22 23 |
# File 'lib/imapcli/stats.rb', line 21 def count @count ||= &.length end |
#max_size ⇒ Object
45 46 47 |
# File 'lib/imapcli/stats.rb', line 45 def max_size @max_size ||= .max end |
#median_size ⇒ Object
37 38 39 |
# File 'lib/imapcli/stats.rb', line 37 def median_size @median_size ||= .median end |
#min_size ⇒ Object
29 30 31 |
# File 'lib/imapcli/stats.rb', line 29 def min_size @min_size ||= .min end |
#quartile_1_size ⇒ Object
33 34 35 |
# File 'lib/imapcli/stats.rb', line 33 def quartile_1_size @quartile_1_size ||= .percentile(25) end |
#quartile_3_size ⇒ Object
41 42 43 |
# File 'lib/imapcli/stats.rb', line 41 def quartile_3_size @quartile_3_size ||= .percentile(75) end |
#total_size ⇒ Object
25 26 27 |
# File 'lib/imapcli/stats.rb', line 25 def total_size @total_size ||= .sum end |