class HaveAPI::Fs::Components::Root

The root of the filesystem. There is only one instance of this object.

This directory contains some special hidden files:

- `.remote_control` is used for IPC between the file system and executables
- `.cache` contains some statistics about the cache
- `.assets/` contains static files for HTML help files

Public Class Methods

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

Public Instance Methods

contents() click to toggle source
# File lib/haveapi/fs/components/root.rb, line 21
def contents
  super + %w(.client_version .fs_version .protocol_version) + \
    @api.resources.keys.map(&:to_s)
end
resources() click to toggle source
# File lib/haveapi/fs/components/root.rb, line 26
def resources
  @api.resources
end
setup() click to toggle source
Calls superclass method HaveAPI::Fs::Component#setup
# File lib/haveapi/fs/components/root.rb, line 16
def setup
  super
  @api = context.fs.api
end
title() click to toggle source
# File lib/haveapi/fs/components/root.rb, line 30
def title
  context.url
end

Protected Instance Methods

new_child(name) click to toggle source
# File lib/haveapi/fs/components/root.rb, line 35
def new_child(name)
  if child = super
    child
  
  elsif @api.resources.has_key?(name)
    [ResourceDir, @api.resources[name]]

  else
    case name
    when :'.remote_control'
      RemoteControlFile

    when :'.assets'
      [
          ProxyDir, 
          ::File.join(
              ::File.realpath(::File.dirname(__FILE__)),
              '..', '..', '..', '..',
              'assets'
          ),
      ]

    when :'.client_version'
      ClientVersion

    when :'.fs_version'
      FsVersion

    when :'.protocol_version'
      ProtocolVersion

    when :'.cache'
      CacheStats

    else
      nil
    end
  end
end