Sha256: e5acbda43a0a111d687be047b257d00809ee9041b71866c1a20dcc8b6ca63609

Contents?: true

Size: 817 Bytes

Versions: 21

Compression:

Stored size: 817 Bytes

Contents

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

module Fog
  module Local

    class Real
      def directories
        Fog::Local::Directories.new(:connection => self)
      end
    end

    class Mock
      def directories
        Fog::Local::Directories.new(:connection => self)
      end
    end

    class Directories < Fog::Collection

      model Fog::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

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
fog-0.1.8 lib/fog/local/models/directories.rb
fog-0.1.7 lib/fog/local/models/directories.rb
fog-0.1.6 lib/fog/local/models/directories.rb
fog-0.1.5 lib/fog/local/models/directories.rb
fog-0.1.4 lib/fog/local/models/directories.rb
fog-0.1.3 lib/fog/local/models/directories.rb
fog-0.1.2 lib/fog/local/models/directories.rb
fog-0.1.1 lib/fog/local/models/directories.rb
fog-0.1.0 lib/fog/local/models/directories.rb
fog-0.0.100 lib/fog/local/models/directories.rb
fog-0.0.99 lib/fog/local/models/directories.rb
fog-0.0.98 lib/fog/local/models/directories.rb
fog-0.0.97 lib/fog/local/models/directories.rb
fog-0.0.96 lib/fog/local/models/directories.rb
fog-0.0.95 lib/fog/local/models/directories.rb
fog-0.0.94 lib/fog/local/models/directories.rb
fog-0.0.93 lib/fog/local/models/directories.rb
fog-0.0.92 lib/fog/local/models/directories.rb
fog-0.0.91 lib/fog/local/models/directories.rb
fog-0.0.90 lib/fog/local/models/directories.rb