class VirtFS::CamcorderFS::Dir

CamcorderFS::Dir class. Instance methods call into CamcorderFS::FS instance.

Constants

NS_PFX

Attributes

fs[R]

Public Class Methods

new(fs, instance_handle, hash_args) click to toggle source
# File lib/virtfs/camcorderfs/dir.rb, line 11
def initialize(fs, instance_handle, hash_args)
  @fs              = fs
  @instance_handle = instance_handle
  @hash_args       = hash_args
  @cache           = nil
end

Public Instance Methods

close() click to toggle source
# File lib/virtfs/camcorderfs/dir.rb, line 18
def close
  fs_call(__method__)
end
read(pos) click to toggle source

returns file_name and new position.

# File lib/virtfs/camcorderfs/dir.rb, line 23
def read(pos)
  return cache[pos], pos + 1
end

Private Instance Methods

cache() click to toggle source
# File lib/virtfs/camcorderfs/dir.rb, line 29
def cache
  @cache ||= fs_call(:each, nil, nil).to_a
end
fs_call(method, *args) click to toggle source
# File lib/virtfs/camcorderfs/dir.rb, line 33
def fs_call(method, *args)
  @fs.send("#{NS_PFX}#{method}", @instance_handle, *args)
end