Class: MetaRequest::Storage
- Inherits:
-
Object
- Object
- MetaRequest::Storage
- Defined in:
- lib/meta_request/storage.rb
Instance Attribute Summary collapse
-
#key ⇒ Object
readonly
Returns the value of attribute key.
Instance Method Summary collapse
-
#initialize(key) ⇒ Storage
constructor
A new instance of Storage.
- #read ⇒ Object
- #write(value) ⇒ Object
Constructor Details
#initialize(key) ⇒ Storage
Returns a new instance of Storage.
7 8 9 |
# File 'lib/meta_request/storage.rb', line 7 def initialize(key) @key = key end |
Instance Attribute Details
#key ⇒ Object (readonly)
Returns the value of attribute key.
5 6 7 |
# File 'lib/meta_request/storage.rb', line 5 def key @key end |
Instance Method Details
#read ⇒ Object
17 18 19 |
# File 'lib/meta_request/storage.rb', line 17 def read File.read(json_file) end |
#write(value) ⇒ Object
11 12 13 14 15 |
# File 'lib/meta_request/storage.rb', line 11 def write(value) FileUtils.mkdir_p dir_path File.open(json_file, 'wb') { |file| file.write(value) } maintain_file_pool(MetaRequest.config.storage_pool_size) end |