class ItemStats

Public Class Methods

new(taggedItems, untaggedItems, readTaggedItems, readUntaggedItems) click to toggle source
# File lib/itemStats.rb, line 5
def initialize(taggedItems, untaggedItems, readTaggedItems, readUntaggedItems)
  @taggedItems = taggedItems
  @untaggedItems = untaggedItems
  @readTaggedItems = readTaggedItems
  @readUntaggedItems = readUntaggedItems
end

Public Instance Methods

print() click to toggle source
printGeneralStats() click to toggle source
# File lib/itemStats.rb, line 16
def printGeneralStats
  tagged = @taggedItems.length
  untagged = @untaggedItems.length
  pctReadTagged = (@readTaggedItems.to_f/tagged)*100
  pctReadUntagged = (@readUntaggedItems.to_f/untagged)*100
  puts '=============================='
  puts '        General Stats         '
  puts '------------------------------'
  puts sprintf "%-15s %2d (%2d%% read)", 'Tagged items:', tagged, pctReadTagged
  puts sprintf "%-15s %2d (%2d%% read)", 'Untagged items:', untagged, pctReadUntagged
  puts '------------------------------'
end