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

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

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

Ruby.getSymbolTable介绍

暂无

代码示例

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

public static RubySymbol getSymbolLong(Ruby runtime, long id) {
  return runtime.getSymbolTable().lookup(id);
}

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

public static RubySymbol newSymbol(Ruby runtime, String name) {
  return runtime.getSymbolTable().getSymbol(name, false);
}

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

@Deprecated
public static IRubyObject all_symbols(IRubyObject recv) {
  return recv.getRuntime().getSymbolTable().all_symbols();
}

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

public static RubySymbol newSymbol(Ruby runtime, String name, Encoding encoding) {
  RubySymbol newSymbol = runtime.getSymbolTable().getSymbol(RubyString.encodeBytelist(name, encoding));
  return newSymbol;
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

@JRubyMethod(name = "all_symbols", meta = true)
public static IRubyObject all_symbols(ThreadContext context, IRubyObject recv) {
  return context.runtime.getSymbolTable().all_symbols();
}
@Deprecated

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

public static RubySymbol newHardSymbol(Ruby runtime, String name, Encoding encoding) {
  RubySymbol newSymbol = runtime.getSymbolTable().getSymbol(RubyString.encodeBytelist(name, encoding));
  return newSymbol;
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

@JRubyMethod(name = "all_symbols", meta = true)
public static IRubyObject all_symbols(ThreadContext context, IRubyObject recv) {
  return context.runtime.getSymbolTable().all_symbols();
}
@Deprecated

代码示例来源:origin: org.asciidoctor/asciidoctorj

private IRubyObject convertJavaValue(Object value) {
  if (value == null) {
    return null;
  } else if (value instanceof String && ((String) value).startsWith(":")) {
    return rubyHash.getRuntime().getSymbolTable().getSymbol(((String) value).substring(1));
  } else {
    return JavaEmbedUtils.javaToRuby(rubyHash.getRuntime(), value);
  }
}

代码示例来源:origin: asciidoctor/asciidoctorj

@Override
public boolean containsKey(Object key) {
  if (!(key instanceof String)) {
    return false;
  }
  RubySymbol symbol = rubyHash.getRuntime().getSymbolTable().getSymbol((String) key);
  return rubyHash.containsKey(symbol);
}

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

@Deprecated
public static RubySymbol newSymbol(Ruby runtime, IRubyObject name) {
  if (name instanceof RubySymbol) {
    return runtime.getSymbolTable().getSymbol(((RubySymbol) name).getBytes(), false);
  } else if (name instanceof RubyString) {
    return runtime.getSymbolTable().getSymbol(((RubyString) name).getByteList(), false);
  } else {
    return newSymbol(runtime, name.asString().getByteList());
  }
}

代码示例来源:origin: org.asciidoctor/asciidoctorj

@Override
public boolean containsKey(Object key) {
  if (!(key instanceof String)) {
    return false;
  }
  RubySymbol symbol = rubyHash.getRuntime().getSymbolTable().getSymbol((String) key);
  return rubyHash.containsKey(symbol);
}

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

public static RubySymbol newHardSymbol(Ruby runtime, IRubyObject name) {
  if (name instanceof RubySymbol) {
    return runtime.getSymbolTable().getSymbol(((RubySymbol) name).getBytes(), true);
  } else if (name instanceof RubyString) {
    return runtime.getSymbolTable().getSymbol(((RubyString) name).getByteList(), true);
  }
  return newSymbol(runtime, name.asString().getByteList());
}

代码示例来源:origin: asciidoctor/asciidoctorj

@Override
public Object get(Object key) {
  if (!(key instanceof String)) {
    return false;
  }
  RubySymbol symbol = rubyHash.getRuntime().getSymbolTable().getSymbol((String) key);
  Object value = rubyHash.get(symbol);
  return convertRubyValue(value);
}

代码示例来源:origin: com.ning.billing/killbill-osgi-bundles-jruby

private RubySymbol checkSpecialCasesIntern(ByteList value) {
  String[][] opTable = getRuntime().is1_8() ? opTable18 : opTable19;
  
  for (int i = 0; i < opTable.length; i++) {
    String op = opTable[i][1];
    if (value.toString().equals(op)) {
      return getRuntime().getSymbolTable().getSymbol(opTable[i][0]);
    }
  }
  
  return null;
}

代码示例来源:origin: org.kill-bill.billing/killbill-osgi-bundles-jruby

private RubySymbol checkSpecialCasesIntern(ByteList value) {
  String[][] opTable = getRuntime().is1_8() ? opTable18 : opTable19;
  
  for (int i = 0; i < opTable.length; i++) {
    String op = opTable[i][1];
    if (value.toString().equals(op)) {
      return getRuntime().getSymbolTable().getSymbol(opTable[i][0]);
    }
  }
  
  return null;
}

代码示例来源:origin: asciidoctor/asciidoctorj

@Override
public Object remove(Object key) {
  if (!(key instanceof String)) {
    return null;
  }
  Object oldValue = get(key);
  RubySymbol symbol = rubyHash.getRuntime().getSymbolTable().getSymbol((String) key);
  rubyHash.remove(symbol);
  return convertRubyValue(oldValue);
}

代码示例来源:origin: asciidoctor/asciidoctorj

@Override
public Object put(String key, Object value) {
  Object oldValue = get(key);
  RubySymbol symbol = rubyHash.getRuntime().getSymbolTable().getSymbol(key);
  rubyHash.put(symbol, convertJavaValue(value));
  return oldValue;
}

代码示例来源:origin: org.asciidoctor/asciidoctorj

@Override
public Object put(String key, Object value) {
  Object oldValue = get(key);
  RubySymbol symbol = rubyHash.getRuntime().getSymbolTable().getSymbol(key);
  rubyHash.put(symbol, convertJavaValue(value));
  return oldValue;
}

代码示例来源:origin: org.asciidoctor/asciidoctorj

@Override
public Object remove(Object key) {
  if (!(key instanceof String)) {
    return null;
  }
  Object oldValue = get(key);
  RubySymbol symbol = rubyHash.getRuntime().getSymbolTable().getSymbol((String) key);
  rubyHash.remove(symbol);
  return convertRubyValue(oldValue);
}

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

/** rb_str_intern
 *
 */
@JRubyMethod(name = {"to_sym", "intern"})
public RubySymbol intern() {
  final Ruby runtime = getRuntime();
  if (scanForCodeRange() == CR_BROKEN) {
    throw runtime.newEncodingError("invalid symbol in encoding " + getEncoding() + " :" + inspect());
  }
  RubySymbol symbol = runtime.getSymbolTable().getSymbol(value);
  if (symbol.getBytes() == value) shareLevel = SHARE_LEVEL_BYTELIST;
  return symbol;
}

相关文章

Ruby类方法