class HaveAPI::Fs::Components::ProxyDir

Public Class Methods

new(path) click to toggle source
Calls superclass method HaveAPI::Fs::Component::new
# File lib/haveapi/fs/components/proxy_dir.rb, line 3
def initialize(path)
  super()
  @path = path
end

Public Instance Methods

contents() click to toggle source
# File lib/haveapi/fs/components/proxy_dir.rb, line 14
def contents
  @dir.entries[2..-1]
end
setup() click to toggle source
Calls superclass method HaveAPI::Fs::Component#setup
# File lib/haveapi/fs/components/proxy_dir.rb, line 8
def setup
  super
  
  @dir = ::Dir.new(@path)
end
times() click to toggle source
# File lib/haveapi/fs/components/proxy_dir.rb, line 18
def times
  st = ::File.stat(@path)
  [st.atime, st.mtime, st.ctime]
end

Protected Instance Methods

new_child(name) click to toggle source
# File lib/haveapi/fs/components/proxy_dir.rb, line 24
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