Class: Tama::Agentic::Author

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(identifier:, source:, klass: "actor") ⇒ Author

Returns a new instance of Author.



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

def initialize(identifier:, source:, klass: "actor")
  Params.require_string!({"identifier" => identifier}, "identifier")
  Params.require_string!({"source" => source}, "source")
  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/author.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/author.rb', line 5

def klass
  @klass
end

#sourceObject (readonly)

Returns the value of attribute source

Returns:

  • (Object)

    the current value of source



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

def source
  @source
end

Class Method Details

.parse(value) ⇒ Object



13
14
15
16
# File 'lib/tama/agentic/author.rb', line 13

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

Instance Method Details

#to_hObject



18
19
20
# File 'lib/tama/agentic/author.rb', line 18

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