Flowdock
method

[]=

Importance_0
v1_9_3_125 - Show latest stable - 0 notes - Class: CStructEntity
[]=(name, val) public

No documentation

This method has no description. You can help the Ruby community by adding new notes.

Hide source
# File ext/dl/lib/dl/struct.rb, line 148
    def []=(name, val)
      idx = @members.index(name)
      if( idx.nil? )
        raise(ArgumentError, "no such member: #{name}")
      end
      ty  = @ctypes[idx]
      packer = Packer.new([ty])
      val = wrap_arg(val, ty, [])
      buff = packer.pack([val].flatten())
      super(@offset[idx], buff.size, buff)
      if( ty.is_a?(Integer) && (ty < 0) )
        return unsigned_value(val, ty)
      elsif( ty.is_a?(Array) && (ty[0] < 0) )
        return val.collect{|v| unsigned_value(v,ty[0])}
      else
        return val
      end
    end
Register or log in to add new notes.