Class: Cadenya::Types::SubAgentSpawned

Inherits:
Object
  • Object
show all
Defined in:
lib/cadenya/types.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(agent: nil, objective: nil, task: nil) ⇒ SubAgentSpawned

Returns a new instance of SubAgentSpawned.



5222
5223
5224
5225
5226
# File 'lib/cadenya/types.rb', line 5222

def initialize(agent: nil, objective: nil, task: nil)
  @agent = agent
  @objective = objective
  @task = task
end

Instance Attribute Details

#agentObject (readonly)

Returns the value of attribute agent.



5220
5221
5222
# File 'lib/cadenya/types.rb', line 5220

def agent
  @agent
end

#objectiveObject (readonly)

Returns the value of attribute objective.



5220
5221
5222
# File 'lib/cadenya/types.rb', line 5220

def objective
  @objective
end

#taskObject (readonly)

Returns the value of attribute task.



5220
5221
5222
# File 'lib/cadenya/types.rb', line 5220

def task
  @task
end

Class Method Details

.from_json(data) ⇒ Object



5228
5229
5230
5231
5232
5233
5234
# File 'lib/cadenya/types.rb', line 5228

def self.from_json(data)
  new(
    agent: data["agent"].nil? ? nil : Types::ResourceMetadata.from_json(data["agent"]),
    objective: data["objective"].nil? ? nil : Types::OperationMetadata.from_json(data["objective"]),
    task: data["task"],
  )
end

Instance Method Details

#to_hObject



5236
5237
5238
5239
5240
5241
5242
# File 'lib/cadenya/types.rb', line 5236

def to_h
  {
    agent: Util.plain(@agent),
    objective: Util.plain(@objective),
    task: Util.plain(@task),
  }.reject { |_k, v| v.nil? }
end