mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
dc61fc09b2
ninefold fix
33 lines
674 B
Ruby
33 lines
674 B
Ruby
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 = Dir.entries(connection.local_root).select do |entry|
|
|
entry[0...1] != '.' && ::File.directory?(connection.path_to(entry))
|
|
end.map do |entry|
|
|
{:key => entry}
|
|
end
|
|
load(data)
|
|
end
|
|
|
|
def get(key)
|
|
if ::File.directory?(connection.path_to(key))
|
|
new(:key => key)
|
|
else
|
|
nil
|
|
end
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
end
|
|
end
|