Class: AgentHarness::ExecutionPreparation::FileWrite

Inherits:
Struct
  • Object
show all
Defined in:
lib/agent_harness/execution_preparation.rb

Overview

Declarative file write request that executors can materialize in their own runtime environment.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(path:, content:, mode: nil) ⇒ FileWrite

Returns a new instance of FileWrite.

Raises:

  • (ArgumentError)


13
14
15
16
17
18
19
20
21
22
# File 'lib/agent_harness/execution_preparation.rb', line 13

def initialize(path:, content:, mode: nil)
  raise ArgumentError, "path must be a non-empty String" unless path.is_a?(String) && !path.empty?
  raise ArgumentError, "content must be a String" unless content.is_a?(String)
  if !mode.nil? && (!mode.is_a?(Integer) || mode.negative?)
    raise ArgumentError, "mode must be a non-negative Integer or nil"
  end

  super
  freeze
end

Instance Attribute Details

#contentObject

Returns the value of attribute content

Returns:

  • (Object)

    the current value of content



12
13
14
# File 'lib/agent_harness/execution_preparation.rb', line 12

def content
  @content
end

#modeObject

Returns the value of attribute mode

Returns:

  • (Object)

    the current value of mode



12
13
14
# File 'lib/agent_harness/execution_preparation.rb', line 12

def mode
  @mode
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



12
13
14
# File 'lib/agent_harness/execution_preparation.rb', line 12

def path
  @path
end