Class: OrchestraAI::Task

Inherits:
Object
  • Object
show all
Defined in:
lib/orchestra_ai/task.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, key:, params: {}) ⇒ Task

Returns a new instance of Task.



7
8
9
10
11
# File 'lib/orchestra_ai/task.rb', line 7

def initialize(id:, key:, params: {})
  @id = id
  @key = key
  @params = params
end

Instance Attribute Details

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/orchestra_ai/task.rb', line 5

def id
  @id
end

#keyObject

Returns the value of attribute key.



5
6
7
# File 'lib/orchestra_ai/task.rb', line 5

def key
  @key
end

#paramsObject

Returns the value of attribute params.



5
6
7
# File 'lib/orchestra_ai/task.rb', line 5

def params
  @params
end

Instance Method Details

#resultObject



13
14
15
16
# File 'lib/orchestra_ai/task.rb', line 13

def result
  action = Object.const_get(key).new
  Result.new(action:, result: action.perform(**@params))
end