class Rex::Struct2::CStruct_Values

Public Class Methods

new(obj) click to toggle source
# File lib/rex/struct2/c_struct.rb, line 10
def initialize(obj)
  @obj = obj
end

Public Instance Methods

[](*args) click to toggle source
# File lib/rex/struct2/c_struct.rb, line 14
def [](*args)
  o = @obj[*args]
  return if !o
  return o.value
end
[]=(*args) click to toggle source
# File lib/rex/struct2/c_struct.rb, line 20
def []=(*args)
  o = @obj[*args[0 .. -2]]
  return if !o
  o.value = args[-1]
end
method_missing(sym, *args) click to toggle source

this one is for HD, the whiniest girl around… allow for like v.field = whatever

# File lib/rex/struct2/c_struct.rb, line 28
def method_missing(sym, *args)
  if sym.to_s[-1] == "="[0]
    return self[sym.to_s[0 .. -2]] = args[0]
  else
    return self[sym.to_s]
  end
end