Sha256: d0b0dc774e7496e8a266cd2fe885e56c7b620c8bc5321daeb40c3cefbd93836a

Contents?: true

Size: 690 Bytes

Versions: 6

Compression:

Stored size: 690 Bytes

Contents

module HaveAPI::Fs::Components
  class ProxyDir < Directory
    def initialize(path)
      super()
      @path = path
    end

    def setup
      super
      
      @dir = ::Dir.new(@path)
    end

    def contents
      @dir.entries[2..-1]
    end

    def times
      st = ::File.stat(@path)
      [st.atime, st.mtime, st.ctime]
    end

    protected
    def new_child(name)
      if child = super
        return child
      end

      real_name = name.to_s
      return unless contents.include?(real_name)
      
      path = ::File.join(@dir.path, real_name)

      if ::File.directory?(path)
        [ProxyDir, path]

      else
        [ProxyFile, path]
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
haveapi-fs-0.11.0 lib/haveapi/fs/components/proxy_dir.rb
haveapi-fs-0.10.0 lib/haveapi/fs/components/proxy_dir.rb
haveapi-fs-0.9.0 lib/haveapi/fs/components/proxy_dir.rb
haveapi-fs-0.8.0 lib/haveapi/fs/components/proxy_dir.rb
haveapi-fs-0.7.1 lib/haveapi/fs/components/proxy_dir.rb
haveapi-fs-0.7.0 lib/haveapi/fs/components/proxy_dir.rb