Class: RailsOrchestrator::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_orchestrator/message.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(role:, content:) ⇒ Message

Returns a new instance of Message.



7
8
9
10
# File 'lib/rails_orchestrator/message.rb', line 7

def initialize(role:, content:)
  @role = role.to_s
  @content = content
end

Instance Attribute Details

#contentObject (readonly)

Returns the value of attribute content.



5
6
7
# File 'lib/rails_orchestrator/message.rb', line 5

def content
  @content
end

#roleObject (readonly)

Returns the value of attribute role.



5
6
7
# File 'lib/rails_orchestrator/message.rb', line 5

def role
  @role
end

Instance Method Details

#==(other) ⇒ Object



16
17
18
# File 'lib/rails_orchestrator/message.rb', line 16

def ==(other)
  other.is_a?(Message) && role == other.role && content == other.content
end

#to_hObject



12
13
14
# File 'lib/rails_orchestrator/message.rb', line 12

def to_h
  { role: @role, content: @content }
end