File: directory.rb

package info (click to toggle)
ruby-fog-local 0.8.0-2
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 212 kB
  • sloc: ruby: 709; makefile: 2
file content (45 lines) | stat: -rw-r--r-- 711 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
module Fog
  module Local
    class Storage
      class Directory < Fog::Model
        identity  :key

        def destroy
          requires :key

          if ::File.directory?(path)
            Dir.rmdir(path)
            true
          else
            false
          end
        end

        def files
          @files ||= Files.new(directory: self, service: service)
        end

        def public=(new_public)
          new_public
        end

        def public_url
          nil
        end

        def save
          requires :key

          FileUtils.mkpath(path)
          true
        end

        private

        def path
          service.path_to(key)
        end
      end
    end
  end
end