class Contracto::Stats
Constants
- NA_TEXT
Attributes
all_contracts[RW]
Public Class Methods
all_responses()
click to toggle source
# File lib/contracto/stats.rb, line 16 def all_responses @all_responses ||= all_contracts.map(&:responses).map(&:count).inject(&:+) end
contracts_stats_summary()
click to toggle source
# File lib/contracto/stats.rb, line 32 def contracts_stats_summary "contracts usage: #{used_contracts.size}/#{all_contracts.size} (#{contracts_usage * 100}%)" end
contracts_usage()
click to toggle source
# File lib/contracto/stats.rb, line 20 def contracts_usage return NA_TEXT if all_contracts.size.zero? (used_contracts.size/all_contracts.size.to_f).round(2) end
responses_stats_summary()
click to toggle source
# File lib/contracto/stats.rb, line 36 def responses_stats_summary "examples usage: #{used_responses.size}/#{all_responses.size} (#{responses_usage * 100}%)" end
responses_usage()
click to toggle source
# File lib/contracto/stats.rb, line 26 def responses_usage return NA_TEXT if all_responses.size.zero? (used_responses.size/all_responses.size.to_f).round(2) end
summary()
click to toggle source
# File lib/contracto/stats.rb, line 40 def summary length = contracts_stats_summary.length [ 'stats'.center(length, '-'), contracts_stats_summary, responses_stats_summary, ('-' * length) + ' ' ].join("\n") end
used_contracts()
click to toggle source
# File lib/contracto/stats.rb, line 8 def used_contracts @used_contracts ||= [] end
used_responses()
click to toggle source
# File lib/contracto/stats.rb, line 12 def used_responses @used_responses ||= [] end