class Shrine::Storage::GoogleCloudStorage::ProcIO
This class provides a writable IO wrapper around a proc object, with write
simply calling the proc, which we can pass in as the destination IO for download.
Public Class Methods
new(&proc)
click to toggle source
# File lib/shrine/storage/google_cloud_storage.rb, line 192 def initialize(&proc) @proc = proc end
Public Instance Methods
flush()
click to toggle source
TODO: Remove this once google/google-api-ruby-client#638 is merged.
# File lib/shrine/storage/google_cloud_storage.rb, line 202 def flush # google-api-client calls this method end
write(data)
click to toggle source
# File lib/shrine/storage/google_cloud_storage.rb, line 196 def write(data) @proc.call(data) data.bytesize # match return value of other IO objects end