Class: OllamaAgent::RuntimeCommandSystem::Suggestion
- Inherits:
-
Object
- Object
- OllamaAgent::RuntimeCommandSystem::Suggestion
- Defined in:
- lib/ollama_agent/runtime_command_system/suggestion.rb
Overview
Immutable completion candidate for the AI Runtime Shell command palette.
Instance Attribute Summary collapse
-
#capabilities ⇒ Object
readonly
Returns the value of attribute capabilities.
-
#description ⇒ Object
readonly
Returns the value of attribute description.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#replacement_start ⇒ Object
readonly
Returns the value of attribute replacement_start.
-
#text ⇒ Object
readonly
Returns the value of attribute text.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
- #display_text ⇒ Object
-
#initialize(text:, type:, description: nil, metadata: {}, capabilities: [], replacement_start: 0) ⇒ Suggestion
constructor
A new instance of Suggestion.
Constructor Details
#initialize(text:, type:, description: nil, metadata: {}, capabilities: [], replacement_start: 0) ⇒ Suggestion
Returns a new instance of Suggestion.
9 10 11 12 13 14 15 16 |
# File 'lib/ollama_agent/runtime_command_system/suggestion.rb', line 9 def initialize(text:, type:, description: nil, metadata: {}, capabilities: [], replacement_start: 0) @text = text.to_s @type = type.to_sym @description = description @metadata = .transform_keys(&:to_sym) @capabilities = Array(capabilities).map(&:to_sym) @replacement_start = replacement_start.to_i end |
Instance Attribute Details
#capabilities ⇒ Object (readonly)
Returns the value of attribute capabilities.
7 8 9 |
# File 'lib/ollama_agent/runtime_command_system/suggestion.rb', line 7 def capabilities @capabilities end |
#description ⇒ Object (readonly)
Returns the value of attribute description.
7 8 9 |
# File 'lib/ollama_agent/runtime_command_system/suggestion.rb', line 7 def description @description end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
7 8 9 |
# File 'lib/ollama_agent/runtime_command_system/suggestion.rb', line 7 def @metadata end |
#replacement_start ⇒ Object (readonly)
Returns the value of attribute replacement_start.
7 8 9 |
# File 'lib/ollama_agent/runtime_command_system/suggestion.rb', line 7 def replacement_start @replacement_start end |
#text ⇒ Object (readonly)
Returns the value of attribute text.
7 8 9 |
# File 'lib/ollama_agent/runtime_command_system/suggestion.rb', line 7 def text @text end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
7 8 9 |
# File 'lib/ollama_agent/runtime_command_system/suggestion.rb', line 7 def type @type end |
Instance Method Details
#display_text ⇒ Object
18 19 20 21 22 23 24 25 26 27 |
# File 'lib/ollama_agent/runtime_command_system/suggestion.rb', line 18 def display_text name_col = text.ljust(30) details = [] details << description if description && !description.empty? badge_str = capabilities.map { |c| "[#{c}]" }.join(" ") return text if details.empty? && badge_str.empty? suffix = details.empty? ? badge_str : "#{details.join(" ")} #{badge_str}".rstrip "#{name_col}#{suffix}" end |