Sha256: 0f5d234d3d4f2de3ebd6face450d8e23b2d7b5a719b59ae4605253d90f375daf

Contents?: true

Size: 1.08 KB

Versions: 8

Compression:

Stored size: 1.08 KB

Contents

module Fog
  module Local
  class Storage < Fog::Service

      requires :local_root

      model_path 'fog/local/models/storage'
      collection  :directories
      model       :directory
      model       :file
      collection  :files

      class Mock

        def self.data
          @data ||= Hash.new do |hash, key|
            hash[key] = {}
          end
        end

        def self.reset_data(keys=data.keys)
          for key in [*keys]
            data.delete(key)
          end
        end

        def initialize(options={})
          @local_root = ::File.expand_path(options[:local_root])
          @data       = self.class.data[@local_root]
        end

        def local_root
          @local_root
        end

        def path(partial)
          partial
        end
      end

      class Real

        def initialize(options={})
          @local_root = ::File.expand_path(options[:local_root])
        end

        def local_root
          @local_root
        end

        def path_to(partial)
          ::File.join(@local_root, partial)
        end
      end

    end
  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
fog-0.3.7 lib/fog/local/storage.rb
fog-0.3.6 lib/fog/local/storage.rb
fog-0.3.5 lib/fog/local/storage.rb
fog-0.3.4 lib/fog/local/storage.rb
fog-0.3.3 lib/fog/local/storage.rb
fog-0.3.2 lib/fog/local/storage.rb
fog-0.3.1 lib/fog/local/storage.rb
fog-0.3.0 lib/fog/local/storage.rb