Sha256: 969059eeccb12f47f19cd0c85107804575485a0f8a1ed5f9ae9a8772399b9c8a

Contents?: true

Size: 870 Bytes

Versions: 9

Compression:

Stored size: 870 Bytes

Contents

require 'fog/core/model'
require 'fog/local/models/storage/files'

module Fog
  module Local
    class Storage

      class Directory < Fog::Model
        extend Fog::Deprecation
        deprecate(:name, :key)
        deprecate(:name=, :key=)

        identity  :key

        def destroy
          requires :key

          if ::File.directory?(path)
            Dir.rmdir(path)
            true
          else
            false
          end
        end

        def files
          @files ||= begin
            Fog::Local::Storage::Files.new(
              :directory    => self,
              :connection   => connection
            )
          end
        end

        def save
          requires :key

          Dir.mkdir(path)
          true
        end

        private

        def path
          connection.path_to(key)
        end

      end

    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
fog-0.3.16 lib/fog/local/models/storage/directory.rb
fog-0.3.15 lib/fog/local/models/storage/directory.rb
fog-0.3.14 lib/fog/local/models/storage/directory.rb
fog-0.3.13 lib/fog/local/models/storage/directory.rb
fog-0.3.12 lib/fog/local/models/storage/directory.rb
fog-0.3.11 lib/fog/local/models/storage/directory.rb
fog-0.3.10 lib/fog/local/models/storage/directory.rb
fog-0.3.9 lib/fog/local/models/storage/directory.rb
fog-0.3.8 lib/fog/local/models/storage/directory.rb