Sha256: a928abc2b9ea1ce785df0ace5c60564922616f30d022654aa2c1552dacd2ad06

Contents?: true

Size: 784 Bytes

Versions: 36

Compression:

Stored size: 784 Bytes

Contents

require 'fog/core/collection'
require 'fog/local/models/storage/directory'

module Fog
  module Storage
    class Local

      class Directories < Fog::Collection

        model Fog::Storage::Local::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 = {})
          if ::File.directory?(service.path_to(key))
            new(:key => key)
          else
            nil
          end
        end

      end

    end
  end
end

Version data entries

36 entries across 36 versions & 2 rubygems

Version Path
fog-1.22.0 lib/fog/local/models/storage/directories.rb
fog-1.21.0 lib/fog/local/models/storage/directories.rb
fog-maestrodev-1.20.0.20140305101839 lib/fog/local/models/storage/directories.rb
fog-maestrodev-1.20.0.20140305101305 lib/fog/local/models/storage/directories.rb
fog-maestrodev-1.19.0.20140212012611 lib/fog/local/models/storage/directories.rb
fog-1.20.0 lib/fog/local/models/storage/directories.rb
fog-maestrodev-1.19.0.20140110004459 lib/fog/local/models/storage/directories.rb
fog-maestrodev-1.19.0.20140110003812 lib/fog/local/models/storage/directories.rb
fog-maestrodev-1.19.0.20140109202555 lib/fog/local/models/storage/directories.rb
fog-maestrodev-1.19.0.20140107192102 lib/fog/local/models/storage/directories.rb
fog-maestrodev-1.19.0.20140107142106 lib/fog/local/models/storage/directories.rb
fog-maestrodev-1.19.0.20131219203941 lib/fog/local/models/storage/directories.rb
fog-maestrodev-1.18.0.20131219193542 lib/fog/local/models/storage/directories.rb
fog-1.19.0 lib/fog/local/models/storage/directories.rb
fog-maestrodev-1.18.0.20131219033443 lib/fog/local/models/storage/directories.rb
fog-maestrodev-1.18.0.20131219032002 lib/fog/local/models/storage/directories.rb
fog-maestrodev-1.18.0.20131219030716 lib/fog/local/models/storage/directories.rb
fog-maestrodev-1.18.0.20131219022322 lib/fog/local/models/storage/directories.rb
fog-maestrodev-1.18.0.20131218202447 lib/fog/local/models/storage/directories.rb
fog-maestrodev-1.18.0.20131209091424 lib/fog/local/models/storage/directories.rb