Module: OllamaChat::Information::UserAgent

Defined in:
lib/ollama_chat/information.rb

Overview

A module that provides user agent functionality for identifying the application.

This module encapsulates methods for determining the application name and constructing a standardized user agent string that includes the application name and version. It is designed to be included in classes that need to provide identification information for HTTP requests or other communications.

Examples:

Accessing the program name

UserAgent.progname # => "ollama_chat"

Generating a user agent string

UserAgent.user_agent # => "ollama_chat/0.0.25"

Instance Method Summary collapse

Instance Method Details

#prognameString

The progname method returns the name of the application.

Returns:

  • (String)

    the application name “ollama_chat”



44
45
46
# File 'lib/ollama_chat/information.rb', line 44

def progname
  'ollama_chat'
end

#user_agentString

The user_agent method constructs and returns a user agent string that combines the program name and the OllamaChat version separated by a forward slash.

Returns:

  • (String)

    the formatted user agent string



53
54
55
# File 'lib/ollama_chat/information.rb', line 53

def user_agent
  [ progname, OllamaChat::VERSION ] * ?/
end