Skip to content

Commit

Permalink
Support for legacy in-memory storage behavior - In memory storage - p…
Browse files Browse the repository at this point in the history
…ersists encoding for upload / download
  • Loading branch information
piiraa committed Sep 25, 2023
1 parent adbe96d commit 62771e1
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
v0.6.1
------
- Support for legacy in-memory storage behavior
* In memory storage - persists encoding for upload / download

v0.6.0
------
- [BREAKING] Remove support for Ruby 2.6
Expand Down
10 changes: 8 additions & 2 deletions lib/bucket_store/in_memory.rb
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ def reset!

def upload!(bucket:, key:, file:)
file.tap do |f|
@buckets[bucket][key] = f.read
@buckets[bucket][key] = {
data: f.read,
encoding: file.external_encoding
}
end

{
Expand All @@ -37,7 +40,10 @@ def upload!(bucket:, key:, file:)

def download(bucket:, key:, file:)
file.tap do |f|
f.write(@buckets[bucket].fetch(key))
f.set_encoding(
@buckets[bucket].fetch(key).fetch(:encoding)
)
f.write(@buckets[bucket].fetch(key).fetch(:data))
f.rewind
end
end
Expand Down
2 changes: 1 addition & 1 deletion lib/bucket_store/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# frozen_string_literal: true

module BucketStore
VERSION = "0.6.0"
VERSION = "0.6.1"
end

0 comments on commit 62771e1

Please sign in to comment.