Class: TelegramWorkflow::Stores::File
- Inherits:
-
Object
- Object
- TelegramWorkflow::Stores::File
- Defined in:
- lib/telegram_workflow/stores/file.rb
Constant Summary collapse
- StorePath =
Pathname.new("tmp/telegram_workflow/file_store")
Instance Method Summary collapse
-
#initialize ⇒ File
constructor
A new instance of File.
- #read(key) ⇒ Object
- #write(key, value) ⇒ Object
Constructor Details
#initialize ⇒ File
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 |