Пример #1
0
  @JRubyMethod(
      name = {"initialize"},
      visibility = PRIVATE)
  public IRubyObject initialize(ThreadContext context, IRubyObject type, IRubyObject address) {
    setMemoryIO(
        address instanceof Pointer
            ? ((Pointer) address).getMemoryIO()
            : Factory.getInstance()
                .wrapDirectMemory(context.runtime, RubyFixnum.num2long(address)));
    size = Long.MAX_VALUE;
    typeSize = calculateTypeSize(context, type);

    return this;
  }
Пример #2
0
 @JRubyMethod(name = "size", meta = true, visibility = PUBLIC)
 public static IRubyObject size(ThreadContext context, IRubyObject recv) {
   return RubyFixnum.newFixnum(
       context.getRuntime(), Factory.getInstance().sizeOf(NativeType.POINTER));
 }