Class: Fog::Local::Directories

Inherits:
Collection show all
Defined in:
lib/fog/local/models/directories.rb

Instance Method Summary collapse

Methods inherited from Collection

#_dump, _load, aliases, attribute, attributes, #attributes, #connection, #connection=, #create, #initialize, #inspect, #load, #merge_attributes, #model, model, #new, #reload, #table, #to_json

Constructor Details

This class inherits a constructor from Fog::Collection

Instance Method Details

#allObject



23
24
25
26
27
28
29
30
# File 'lib/fog/local/models/directories.rb', line 23

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

#get(key) ⇒ Object



32
33
34
35
36
37
38
# File 'lib/fog/local/models/directories.rb', line 32

def get(key)
  if ::File.directory?(connection.path_to(key))
    new(:key => key)
  else
    nil
  end
end