Class: TelegramWorkflow::Stores::File

Inherits:
Object
  • Object
show all
Defined in:
lib/telegram_workflow/stores/file.rb

Constant Summary collapse

StorePath =
Pathname.new("tmp/telegram_workflow/file_store")

Instance Method Summary collapse

Constructor Details

#initializeFile

Returns a new instance of File.



6
7
8
9
# File 'lib/telegram_workflow/stores/file.rb', line 6

def initialize
  StorePath.dirname.mkpath unless StorePath.exist?
  @store = DBM.open(StorePath.to_s)
end

Instance Method Details

#read(key) ⇒ Object



11
12
13
# File 'lib/telegram_workflow/stores/file.rb', line 11

def read(key)
  @store[key.to_s]
end

#write(key, value) ⇒ Object



15
16
17
# File 'lib/telegram_workflow/stores/file.rb', line 15

def write(key, value)
  @store[key.to_s] = value
end