Sha256: 6537abb01c5bb0f9e9e4422d9f266c1ea07e4f58842df8d7bc07a7c91d11b77f

Contents?: true

Size: 624 Bytes

Versions: 1

Compression:

Stored size: 624 Bytes

Contents

# frozen_string_literal: true

require "stashify/file"

module Stashify
  class File
    module Google
      module Cloud
        class Storage < Stashify::File
          def initialize(bucket:, path:)
            @bucket = bucket
            super(path: path)
          end

          def contents
            @bucket.file(path).download.string
          end

          def write(contents)
            @bucket.create_file(
              StringIO.new(contents),
              path,
            )
          end

          def delete
            @bucket.file(path).delete
          end
        end
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
stashify-google-cloud-storage-3.0.0 lib/stashify/file/google/cloud/storage.rb