class Mingle::Stats

Constants

SPACER

Attributes

cards_fixed[RW]
cards_without_attachments[RW]
problematic_cards[RW]
total_cards_checked[RW]

Public Class Methods

new() click to toggle source
# File lib/mingle/stats.rb, line 9
def initialize
  @total_cards_checked = 0
  @cards_without_attachments = 0
  @cards_without_links = 0
  @problematic_cards = {}
  @cards_fixed = 0
  @start = Time.now
end

Public Instance Methods

to_pretty_string() click to toggle source
# File lib/mingle/stats.rb, line 18
def to_pretty_string
  %{
    #{SPACER}
    SUMMARY

    Completed in #{duration_in_seconds} sec

    Total Cards Checked:         #{total_cards_checked}
    Cards Without Attachments:   #{cards_without_attachments}
    Cards Without Fixable Links: #{cards_without_links}

    Problematic Cards:           #{problematic_cards.size}
    #{'(specific errors can be seen if you set VERBOSE environment variable)' if problematic_cards.any?}
    #{ problematic_cards_with_errors if Logging::VERBOSE }

    Fixed Cards:                 #{cards_fixed}
    #{SPACER}
  }
end

Private Instance Methods

duration_in_seconds() click to toggle source
# File lib/mingle/stats.rb, line 40
def duration_in_seconds
  Time.now - @start
end
problematic_cards_with_errors() click to toggle source
# File lib/mingle/stats.rb, line 44
def problematic_cards_with_errors
  problematic_cards.inject([]) do |lines, pair|
    card_number, error = pair
    lines << "\nCard ##{card_number}: #{error.message}\n"
  end.join("\n")
end