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



43
44
45
# File 'lib/vangrail/conversation.rb', line 43

def origin
  @origin
end

#resultObject

Returns the value of attribute result

Returns:

  • (Object)

    the current value of result



43
44
45
# File 'lib/vangrail/conversation.rb', line 43

def result
  @result
end

#roleObject

Returns the value of attribute role

Returns:

  • (Object)

    the current value of role



43
44
45
# File 'lib/vangrail/conversation.rb', line 43

def role
  @role
end

#textObject

Returns the value of attribute text

Returns:

  • (Object)

    the current value of text



43
44
45
# File 'lib/vangrail/conversation.rb', line 43

def text
  @text
end

Instance Method Details

#blocked?Boolean

Returns:

  • (Boolean)


44
45
46
# File 'lib/vangrail/conversation.rb', line 44

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

#to_hObject



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

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

#user?Boolean

Returns:

  • (Boolean)


48
49
50
# File 'lib/vangrail/conversation.rb', line 48

def user?
  role == :user
end