Sha256: 52598ac568a95b8d1f677e0e2b4acd46c889b84fc90931d6ffb75cc37d8007eb

Contents?: true

Size: 787 Bytes

Versions: 3

Compression:

Stored size: 787 Bytes

Contents

module Fog
  module Local
    class Storage
      class Directories < Fog::Collection
        model Directory

        def all
          data = if ::File.directory?(service.local_root)
            Dir.entries(service.local_root).select do |entry|
              entry[0...1] != '.' && ::File.directory?(service.path_to(entry))
            end.map do |entry|
              {:key => entry}
            end
          else
            []
          end
          load(data)
        end

        def get(key, options = {})
          create_directory(key, options) if ::File.directory?(service.path_to(key))
        end

        private

        def create_directory(key, options)
          options[:path] ? new(key: key + options[:path]) : new(key: key)
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
fog-local-0.8.0 lib/fog/local/models/directories.rb
fog-local-0.7.0 lib/fog/local/models/directories.rb
fog-local-0.6.0 lib/fog/local/models/directories.rb