Class: OllamaAgent::RuntimeCommandSystem::AST::CommandNode

Inherits:
Object
  • Object
show all
Defined in:
lib/ollama_agent/runtime_command_system/ast.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name:, arguments: [], options: {}, raw: "", cursor_pos: 0) ⇒ CommandNode

Returns a new instance of CommandNode.



9
10
11
12
13
14
15
# File 'lib/ollama_agent/runtime_command_system/ast.rb', line 9

def initialize(name:, arguments: [], options: {}, raw: "", cursor_pos: 0)
  @name = name.to_s
  @arguments = arguments
  @options = options
  @raw = raw.to_s
  @cursor_pos = cursor_pos.to_i
end

Instance Attribute Details

#argumentsObject (readonly)

Returns the value of attribute arguments.



7
8
9
# File 'lib/ollama_agent/runtime_command_system/ast.rb', line 7

def arguments
  @arguments
end

#cursor_posObject (readonly)

Returns the value of attribute cursor_pos.



7
8
9
# File 'lib/ollama_agent/runtime_command_system/ast.rb', line 7

def cursor_pos
  @cursor_pos
end

#nameObject (readonly)

Returns the value of attribute name.



7
8
9
# File 'lib/ollama_agent/runtime_command_system/ast.rb', line 7

def name
  @name
end

#optionsObject (readonly)

Returns the value of attribute options.



7
8
9
# File 'lib/ollama_agent/runtime_command_system/ast.rb', line 7

def options
  @options
end

#rawObject (readonly)

Returns the value of attribute raw.



7
8
9
# File 'lib/ollama_agent/runtime_command_system/ast.rb', line 7

def raw
  @raw
end

Instance Method Details

#argument_context?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/ollama_agent/runtime_command_system/ast.rb', line 25

def argument_context?
  raw.include?(" ")
end

#command_textObject



17
18
19
# File 'lib/ollama_agent/runtime_command_system/ast.rb', line 17

def command_text
  "/#{name}"
end

#current_argumentObject



21
22
23
# File 'lib/ollama_agent/runtime_command_system/ast.rb', line 21

def current_argument
  arguments.last
end