org.jruby.Ruby.getData()方法的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(4.3k)|赞(0)|评价(0)|浏览(120)

本文整理了Java中org.jruby.Ruby.getData方法的一些代码示例,展示了Ruby.getData的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Ruby.getData方法的具体详情如下:
包路径:org.jruby.Ruby
类名称:Ruby
方法名:getData

Ruby.getData介绍

暂无

代码示例

代码示例来源:origin: org.jruby/jruby-complete

public static void createAddrinfo(Ruby runtime) {
  RubyClass addrinfo = runtime.defineClass(
      "Addrinfo",
      runtime.getData(),
      new ObjectAllocator() {
        public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
          return new Addrinfo(runtime, klazz);
        }
      });
  addrinfo.defineAnnotatedMethods(Addrinfo.class);
}

代码示例来源:origin: org.jruby/jruby-core

public static void createAddrinfo(Ruby runtime) {
  RubyClass addrinfo = runtime.defineClass(
      "Addrinfo",
      runtime.getData(),
      new ObjectAllocator() {
        public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
          return new Addrinfo(runtime, klazz);
        }
      });
  addrinfo.defineAnnotatedMethods(Addrinfo.class);
}

代码示例来源:origin: org.jruby/jruby-complete

public static void createIfaddr(Ruby runtime) {
  RubyClass ifaddr = runtime.getClass("Socket").defineClassUnder(
      "Ifaddr",
      runtime.getData(),
      new ObjectAllocator() {
        public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
          return new Ifaddr(runtime, klazz);
        }
      });
  ifaddr.defineAnnotatedMethods(Ifaddr.class);
}

代码示例来源:origin: org.jruby/jruby-core

public static void createIfaddr(Ruby runtime) {
  RubyClass ifaddr = runtime.getClass("Socket").defineClassUnder(
      "Ifaddr",
      runtime.getData(),
      new ObjectAllocator() {
        public IRubyObject allocate(Ruby runtime, RubyClass klazz) {
          return new Ifaddr(runtime, klazz);
        }
      });
  ifaddr.defineAnnotatedMethods(Ifaddr.class);
}

代码示例来源:origin: org.jruby/jruby-complete

public static RubyClass createConverterClass(Ruby runtime) {
  RubyClass converterc = runtime.defineClassUnder("Converter", runtime.getData(), CONVERTER_ALLOCATOR, runtime.getEncoding());
  runtime.setConverter(converterc);
  converterc.setClassIndex(ClassIndex.CONVERTER);
  converterc.setReifiedClass(RubyConverter.class);
  converterc.kindOf = new RubyModule.JavaClassKindOf(RubyConverter.class);
  converterc.defineAnnotatedMethods(RubyConverter.class);
  converterc.defineAnnotatedConstants(RubyConverter.class);
  return converterc;
}

代码示例来源:origin: org.jruby/jruby-core

public static RubyClass createConverterClass(Ruby runtime) {
  RubyClass converterc = runtime.defineClassUnder("Converter", runtime.getData(), CONVERTER_ALLOCATOR, runtime.getEncoding());
  runtime.setConverter(converterc);
  converterc.setClassIndex(ClassIndex.CONVERTER);
  converterc.setReifiedClass(RubyConverter.class);
  converterc.kindOf = new RubyModule.JavaClassKindOf(RubyConverter.class);
  converterc.defineAnnotatedMethods(RubyConverter.class);
  converterc.defineAnnotatedConstants(RubyConverter.class);
  return converterc;
}

代码示例来源:origin: org.jruby/jruby-complete

public static RubyClass createStringIOClass(final Ruby runtime) {
  RubyClass stringIOClass = runtime.defineClass(
      "StringIO", runtime.getData(), STRINGIO_ALLOCATOR);
  stringIOClass.defineAnnotatedMethods(StringIO.class);
  stringIOClass.includeModule(runtime.getEnumerable());
  if (runtime.getObject().isConstantDefined("Java")) {
    stringIOClass.defineAnnotatedMethods(IOJavaAddons.AnyIO.class);
  }
  RubyModule genericReadable = runtime.getIO().defineOrGetModuleUnder("GenericReadable");
  genericReadable.defineAnnotatedMethods(GenericReadable.class);
  stringIOClass.includeModule(genericReadable);
  RubyModule genericWritable = runtime.getIO().defineOrGetModuleUnder("GenericWritable");
  genericWritable.defineAnnotatedMethods(GenericWritable.class);
  stringIOClass.includeModule(genericWritable);
  return stringIOClass;
}

代码示例来源:origin: org.jruby/jruby-core

public static RubyClass createStringIOClass(final Ruby runtime) {
  RubyClass stringIOClass = runtime.defineClass(
      "StringIO", runtime.getData(), STRINGIO_ALLOCATOR);
  stringIOClass.defineAnnotatedMethods(StringIO.class);
  stringIOClass.includeModule(runtime.getEnumerable());
  if (runtime.getObject().isConstantDefined("Java")) {
    stringIOClass.defineAnnotatedMethods(IOJavaAddons.AnyIO.class);
  }
  RubyModule genericReadable = runtime.getIO().defineOrGetModuleUnder("GenericReadable");
  genericReadable.defineAnnotatedMethods(GenericReadable.class);
  stringIOClass.includeModule(genericReadable);
  RubyModule genericWritable = runtime.getIO().defineOrGetModuleUnder("GenericWritable");
  genericWritable.defineAnnotatedMethods(GenericWritable.class);
  stringIOClass.includeModule(genericWritable);
  return stringIOClass;
}

相关文章

Ruby类方法