Class: NFS::XDR::FixedArray

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

Instance Method Summary collapse

Constructor Details

#initialize(type, n) ⇒ FixedArray

Returns a new instance of FixedArray.



136
137
138
# File 'lib/nfs/xdr.rb', line 136

def initialize(type, n)
  @type, @n = type, n
end

Instance Method Details

#decode(string) ⇒ Object



146
147
148
149
150
# File 'lib/nfs/xdr.rb', line 146

def decode(string)
  Array.new(n) do
    @type.decode(string)
  end
end

#encode(value) ⇒ Object



140
141
142
143
144
# File 'lib/nfs/xdr.rb', line 140

def encode(value)
  n.times do |i|
    @type.encode(value[i])
  end
end