Module: Reading::Stats::ResultFormatters

Defined in:
lib/reading/stats/result_formatters.rb

Constant Summary collapse

TRUNCATED_TITLES =
{
  top_length: ->(result) { with_truncated_title(result) },
  top_amount: ->(result) { with_truncated_title(result) },
  top_speed: ->(result) { with_truncated_title(result) },
  top_experience: ->(result) { with_truncated_title(result) },
  top_note: ->(result) { with_truncated_title(result) },
  bottom_length: ->(result) { with_truncated_title(result) },
  botom_amount: ->(result) { with_truncated_title(result) },
  bottom_speed: ->(result) { with_truncated_title(result) },
}
TERMINAL =
{
  average_length: ->(result) { length_to_s(result) },
  average_amount: ->(result) { length_to_s(result) },
  :"average_daily-amount" => ->(result) { "#{length_to_s(result)} per day" },
  total_item: ->(result) {
    if result.zero?
      "none"
    else
      "#{result} #{result == 1 ? "item" : "items"}"
    end
  },
  total_amount: ->(result) { length_to_s(result) },
  top_rating: ->(result) { top_or_bottom_numbers_string(result, noun: "star") },
  top_length: ->(result) { top_or_bottom_lengths_string(result) },
  top_amount: ->(result) { top_or_bottom_lengths_string(result) },
  top_speed: ->(result) { top_or_bottom_speeds_string(result) },
  top_experience: ->(result) { top_or_bottom_numbers_string(result, noun: "experience") },
  top_note: ->(result) { top_or_bottom_numbers_string(result, noun: "word") },
  bottom_rating: ->(result) { top_or_bottom_numbers_string(result, noun: "star") },
  bottom_length: ->(result) { top_or_bottom_lengths_string(result) },
  botom_amount: ->(result) { top_or_bottom_lengths_string(result) },
  bottom_speed: ->(result) { top_or_bottom_speeds_string(result) },
}