Module: OllamaChat::Utils::ValueFormatter

Included in:
Chat, FollowChat, Tools::Concern
Defined in:
lib/ollama_chat/utils/value_formatter.rb

Overview

Module to format values for user consumption.

Instance Method Summary collapse

Instance Method Details

#format_bytes(bytes) ⇒ String

Formats a byte value into a human‑readable string with units

Parameters:

  • bytes (Integer)

    the number of bytes to format

Returns:

  • (String)

    the formatted byte string



7
8
9
# File 'lib/ollama_chat/utils/value_formatter.rb', line 7

def format_bytes(bytes)
  Tins::Unit.format(bytes, unit: ?B, prefix: 1024, format: '%.1f %U')
end