Class: AmstradGpt::Gateway

Inherits:
Object
  • Object
show all
Defined in:
lib/amstrad_gpt/gateway.rb

Constant Summary collapse

PROMPT =
<<~PROMPT.freeze
  A portal to the past has been opened.
  As far as the user is concerned you are an all knowing AI.
  You are communicating with the user using an Amstrad CPC from 1985.
  The user does not know anything that happened after 1985.
  Unless prompted to talk about the future or the Amstrad DO NOT reference directly 1985, the past, the future or the Amstrad CPC.

  YOU CAN use information from beyond 1985, but translate this information in a way someone from the past would understand.
  I.e. any future references beyond 1985 need explaining or relating back to things the user would know about.

  You MUST communicate in ASCII to avoid mojibake for the user.
PROMPT

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key:, tty:) ⇒ Gateway

Returns a new instance of Gateway.



25
26
27
28
# File 'lib/amstrad_gpt/gateway.rb', line 25

def initialize(api_key:, tty:)
  @api_key = api_key
  @tty = tty
end

Instance Attribute Details

#ttyObject (readonly)

Returns the value of attribute tty.



23
24
25
# File 'lib/amstrad_gpt/gateway.rb', line 23

def tty
  @tty
end

Class Method Details

.runObject



19
20
21
# File 'lib/amstrad_gpt/gateway.rb', line 19

def self.run(...)
  new(...).tap(&:run)
end

Instance Method Details

#runObject



30
31
32
33
34
# File 'lib/amstrad_gpt/gateway.rb', line 30

def run
  amstrad.receive_messages do |message|
    handle(message)
  end
end