Class: Twitch::Bot::Memory::Hash

Inherits:
Object
  • Object
show all
Defined in:
lib/twitch/bot/memory/hash.rb

Overview

Implement an ephemeral memory using a Hash

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Hash

Returns a new instance of Hash.



9
10
11
12
# File 'lib/twitch/bot/memory/hash.rb', line 9

def initialize(client:)
  @client = client
  @kvstore = {}
end

Instance Method Details

#retrieve(key) ⇒ Object



18
19
20
# File 'lib/twitch/bot/memory/hash.rb', line 18

def retrieve(key)
  kvstore[key]
end

#store(key, value) ⇒ Object



14
15
16
# File 'lib/twitch/bot/memory/hash.rb', line 14

def store(key, value)
  kvstore[key] = value
end