1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/lib/fog/local/models/storage/directories.rb
Paul Thornthwaite 2e0b7e545a Standardise empty lines throughout codebase
Done with `rubocop --auto-correct --only EmptyLineBetweenDefs,EmptyLines,EmptyLinesAroundBody`
2014-05-26 14:20:02 +01:00

33 lines
780 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 = 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