Class: Vangrail::Conversation::Turn

Inherits:
Struct
  • Object
show all
Defined in:
lib/vangrail/conversation.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#originObject

Returns the value of attribute origin

Returns:

  • (Object)

    the current value of origin



50
51
52
# File 'lib/vangrail/conversation.rb', line 50

def origin
  @origin
end

#resultObject

Returns the value of attribute result

Returns:

  • (Object)

    the current value of result



50
51
52
# File 'lib/vangrail/conversation.rb', line 50

def result
  @result
end

#roleObject

Returns the value of attribute role

Returns:

  • (Object)

    the current value of role



50
51
52
# File 'lib/vangrail/conversation.rb', line 50

def role
  @role
end

#textObject

Returns the value of attribute text

Returns:

  • (Object)

    the current value of text



50
51
52
# File 'lib/vangrail/conversation.rb', line 50

def text
  @text
end

Instance Method Details

#blocked?Boolean

Returns:

  • (Boolean)


51
52
53
# File 'lib/vangrail/conversation.rb', line 51

def blocked?
  result&.blocked? || false
end

#to_hObject



59
60
61
62
# File 'lib/vangrail/conversation.rb', line 59

def to_h
  { 'role' => role.to_s, 'text' => text, 'origin' => origin&.to_s,
    'result' => result&.to_h }.compact
end

#user?Boolean

Returns:

  • (Boolean)


55
56
57
# File 'lib/vangrail/conversation.rb', line 55

def user?
  role == :user
end