Sha256: 8bf2924177ba7fbee2c5ea3b8830f31ffec9b10f1893abea3e53709a2c5e91f2
Contents?: true
Size: 1.24 KB
Versions: 1
Compression:
Stored size: 1.24 KB
Contents
# frozen_string_literal: true require "stashify/directory" require "stashify/file/google/cloud/storage" module Stashify class Directory module Google module Cloud class Storage < Stashify::Directory attr_reader :bucket def initialize(bucket:, path:) @bucket = bucket super(path: path) end def files @bucket.files.map do |gcloud_file| find(::Regexp.last_match(1)) if gcloud_file.name =~ %r{^#{Regexp.escape(path)}/([^/]*)(/.*)?$} end.compact end def ==(other) self.class == other.class && @bucket == other.bucket && path == other.path end private def directory?(name) path = path_of(name) !@bucket.file(path) && !@bucket.files(prefix: path).empty? end def directory(name) Stashify::Directory::Google::Cloud::Storage.new(bucket: @bucket, path: path_of(name)) end def file?(name) @bucket.file(path_of(name)) end def file(name) Stashify::File::Google::Cloud::Storage.new(bucket: @bucket, path: path_of(name)) 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/directory/google/cloud/storage.rb |