Class: NFS::Filehandle

Inherits:
String
  • Object
show all
Defined in:
lib/nfs/filehandle.rb

Instance Method Summary collapse

Constructor Details

#initializeFilehandle

Returns a new instance of Filehandle.



3
4
5
# File 'lib/nfs/filehandle.rb', line 3

def initialize
  super("\0".b * NFS::FHSIZE)
end

Instance Method Details

#[](idx) ⇒ Object



16
17
18
# File 'lib/nfs/filehandle.rb', line 16

def [](idx)
  getbyte(idx)
end

#[]=(idx, newval) ⇒ Object



20
21
22
# File 'lib/nfs/filehandle.rb', line 20

def []=(idx, newval)
  setbyte(idx, newval)
end

#increment!Object



7
8
9
10
11
12
13
14
# File 'lib/nfs/filehandle.rb', line 7

def increment!
  size.times do |i|
    self[i] += 1
    return self if self[i] != 0
  end

  self
end