lib/obst/pack_log.rb in obst-0.1.2 vs lib/obst/pack_log.rb in obst-0.1.3
- old
+ new
@@ -16,12 +16,34 @@
end
def inspect
@arr
end
+
+ def final
+ return :d if @arr[0] == :d
+ return :a if @arr[-1] == :a
+ :m
+ end
end
- Record = Struct.new(:time, :statuses)
+ Record = Struct.new(:time, :statuses) do
+ def status_sum
+ sum = Hash.new{ |h, k| h[k] = 0 }
+ statuses.each_value do |status|
+ sum[status.final] += 1
+ end
+ sum
+ end
+
+ def str_status_sum
+ sb = []
+ status_sum.each_pair do |st, count|
+ sb << "#{st}: #{count}"
+ end
+ sb.join(', ')
+ end
+ end
def each(&block)
current_time = nil
renames = {}
files_in_one_day = Hash.new{ |files, name| files[name] = Statuses.new }