Skip to content

Commit

Permalink
Yield content length when streaming
Browse files Browse the repository at this point in the history
This will be used by the download_endpoint Shrine plugin to set
Content-Length before it starts streaming.
  • Loading branch information
janko committed Apr 15, 2016
1 parent 6c769e5 commit a773679
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions Rakefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,5 @@ require "rake/testtask"
Rake::TestTask.new do |t|
t.libs << "test"
t.test_files = FileList["test/**/*_test.rb"]
t.warning = false
end
4 changes: 3 additions & 1 deletion lib/shrine/storage/fog.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ def download(id)
end

def stream(id)
get(id) { |chunk| yield chunk }
get(id) do |chunk, _, content_length|
yield chunk, content_length
end
end

def open(id)
Expand Down
2 changes: 1 addition & 1 deletion shrine-fog.gemspec
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Gem::Specification.new do |gem|
gem.name = "shrine-fog"
gem.version = "0.2.0"
gem.version = "0.2.1"

gem.required_ruby_version = ">= 2.1"

Expand Down

0 comments on commit a773679

Please sign in to comment.