Sha256: 86a13b1efe8d8b350c0bf235efbee90208faae330a5612de0d1b90268484879c

Contents?: true

Size: 890 Bytes

Versions: 7

Compression:

Stored size: 890 Bytes

Contents

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

module Fog
  module Local
    class Storage

      class Directory < Fog::Model

        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 public=(new_public)
          new_public
        end

        def public_url
          nil
        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

7 entries across 7 versions & 1 rubygems

Version Path
fog-0.8.2 lib/fog/storage/models/local/directory.rb
fog-0.8.1 lib/fog/storage/models/local/directory.rb
fog-0.8.0 lib/fog/storage/models/local/directory.rb
fog-0.7.2 lib/fog/storage/models/local/directory.rb
fog-0.7.1 lib/fog/storage/models/local/directory.rb
fog-0.7.0 lib/fog/storage/models/local/directory.rb
fog-0.6.0 lib/fog/storage/models/local/directory.rb