Class: Tama::Agentic::Thread

Inherits:
Data
  • Object
show all
Defined in:
lib/tama/agentic/thread.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identifier:, klass: "thread") ⇒ Thread

Returns a new instance of Thread.



6
7
8
9
10
# File 'lib/tama/agentic/thread.rb', line 6

def initialize(identifier:, klass: "thread")
  Params.require_string!({"identifier" => identifier}, "identifier")
  Params.require_string!({"class" => klass}, "class")
  super
end

Instance Attribute Details

#identifierObject (readonly)

Returns the value of attribute identifier

Returns:

  • (Object)

    the current value of identifier



5
6
7
# File 'lib/tama/agentic/thread.rb', line 5

def identifier
  @identifier
end

#klassObject (readonly)

Returns the value of attribute klass

Returns:

  • (Object)

    the current value of klass



5
6
7
# File 'lib/tama/agentic/thread.rb', line 5

def klass
  @klass
end

Class Method Details

.parse(value) ⇒ Object



12
13
14
15
# File 'lib/tama/agentic/thread.rb', line 12

def self.parse(value)
  data = Params.hash(value, "thread")
  new(identifier: data["identifier"], klass: data.fetch("class", "thread"))
end

Instance Method Details

#to_hObject



17
18
19
# File 'lib/tama/agentic/thread.rb', line 17

def to_h
  {"identifier" => identifier, "class" => klass}
end