Class: OllamaChat::Utils::TagResolver::TagResult

Inherits:
Struct
  • Object
show all
Defined in:
lib/ollama_chat/utils/tag_resolver.rb

Overview

A lightweight struct representing a single tag entry. It extends the base Struct with convenience methods for generating human‑readable messages and JSON representations.

Instance Method Summary collapse

Instance Method Details

#as_json(*a) ⇒ Hash

Convert to a hash suitable for JSON serialization. The rest field is omitted because it contains raw ctags data that isn’t useful outside the library.

Returns:

  • (Hash)


55
56
57
58
59
# File 'lib/ollama_chat/utils/tag_resolver.rb', line 55

def as_json(*a)
  hash = super
  hash.delete('rest')
  hash | { 'message' => message, 'kind_type' => kind_type }
end

#kind_typeString

Resolve the full, human‑readable type for the kind field using OllamaChat::Utils::TagResolver.kind_of.

Returns:

  • (String)


47
48
49
# File 'lib/ollama_chat/utils/tag_resolver.rb', line 47

def kind_type
  OllamaChat::Utils::TagResolver.kind_of(kind)
end

#messageString

Returns Human readable description of this tag result.

Returns:

  • (String)

    Human readable description of this tag result.



40
41
42
# File 'lib/ollama_chat/utils/tag_resolver.rb', line 40

def message
  "#{symbol} of kind #{kind} (#{kind_type}) at #{filename}:#{linenumber}"
end

#to_json(*a) ⇒ String

JSON representation of this tag result. Delegates to as_json.

Returns:

  • (String)


63
64
65
# File 'lib/ollama_chat/utils/tag_resolver.rb', line 63

def to_json(*a)
  as_json.to_json(*a)
end