public static RubyHash toNoneSymbolsRubyHash(Ruby rubyRuntime, Map<String, Object> map) { RubyHash rubyHash = new RubyHash(rubyRuntime); Set<Entry<String, Object>> entrySet = map.entrySet(); for (Entry<String, Object> entry : entrySet) { rubyHash.put(toJavaObject(entry.getKey()), toJavaObject(entry.getValue())); } return rubyHash; }
public static RubyHash toNoneSymbolsRubyHash(Ruby rubyRuntime, Map<String, Object> map) { RubyHash rubyHash = new RubyHash(rubyRuntime); Set<Entry<String, Object>> entrySet = map.entrySet(); for (Entry<String, Object> entry : entrySet) { rubyHash.put(toJavaObject(entry.getKey()), toJavaObject(entry.getValue())); } return rubyHash; }
public static RubyHash toNoneSymbolsRubyHash(Ruby rubyRuntime, Map<String, Object> map) { RubyHash rubyHash = new RubyHash(rubyRuntime); Set<Entry<String, Object>> entrySet = map.entrySet(); for (Entry<String, Object> entry : entrySet) { rubyHash.put(toJavaObject(entry.getKey()), toJavaObject(entry.getValue())); } return rubyHash; }
private RubyHash convertToRubyHash(Set<Map.Entry<String, Object>> entries) { RubyHash hash = newHash(runtime); for (Map.Entry<String, Object> entry : entries) { String key = entry.getKey(); Object value = entry.getValue(); if (key.equals("rack.input")) { value = new JRubyRackInput(runtime, (RackInput) value); } if (key.equals("rack.version")) { value = convertToRubyArray((List<Integer>) value); } hash.put(key, value); } return hash; }
public static RubyHash convertMapToRubyHashWithSymbols(Ruby rubyRuntime, Map<String, Object> options) { RubyHash rubyHash = new RubyHash(rubyRuntime); Set<Entry<String, Object>> optionsSet = options.entrySet(); for (Entry<String, Object> entry : optionsSet) { String key = entry.getKey(); Object value = entry.getValue(); RubySymbol newSymbol = RubyUtils.toSymbol(rubyRuntime, key); IRubyObject iRubyValue = toRubyObject(rubyRuntime, value); rubyHash.put(newSymbol, iRubyValue); } return rubyHash; }
public void setASTNode(ContentNode astNode) { cache.put(getRuntime().newSymbol(KEY_AST_NODE), astNode); }
public void setASTNode(ContentNode astNode) { cache.put(getRuntime().newSymbol(KEY_AST_NODE), astNode); }
public static RubyHash convertMapToRubyHashWithSymbols(Ruby rubyRuntime, Map<String, Object> options) { if (options instanceof RubyHashMapDecorator) { return ((RubyHashMapDecorator) options).getRubyHash(); } RubyHash rubyHash = new RubyHash(rubyRuntime); Set<Entry<String, Object>> optionsSet = options.entrySet(); for (Entry<String, Object> entry : optionsSet) { String key = entry.getKey(); Object value = entry.getValue(); RubySymbol newSymbol = RubyUtils.toSymbol(rubyRuntime, key); IRubyObject iRubyValue = toRubyObject(rubyRuntime, value); rubyHash.put(newSymbol, iRubyValue); } return rubyHash; }
public static RubyHash convertMapToRubyHashWithSymbols(Ruby rubyRuntime, Map<String, Object> options) { if (options instanceof RubyHashMapDecorator) { return ((RubyHashMapDecorator) options).getRubyHash(); } RubyHash rubyHash = new RubyHash(rubyRuntime); Set<Entry<String, Object>> optionsSet = options.entrySet(); for (Entry<String, Object> entry : optionsSet) { String key = entry.getKey(); Object value = entry.getValue(); RubySymbol newSymbol = RubyUtils.toSymbol(rubyRuntime, key); IRubyObject iRubyValue = toRubyObject(rubyRuntime, value); rubyHash.put(newSymbol, iRubyValue); } return rubyHash; }
@Override public Object put(String key, Object value) { final Object convertedKey = convertJavaToRubyKey(key); Object oldValue = rubyHash.get(convertedKey); rubyHash.put(convertedKey, convertJavaValue(value)); return oldValue; }
@Override public Object put(String key, Object value) { final Object convertedKey = convertJavaToRubyKey(key); Object oldValue = rubyHash.get(convertedKey); rubyHash.put(convertedKey, convertJavaValue(value)); return oldValue; }
private static void handleDefaultAttributeAnnotation(Class<? extends Processor> processor, RubyClass rubyClass) { Ruby rubyRuntime = rubyClass.getRuntime(); if (processor.isAnnotationPresent(DefaultAttribute.class)) { DefaultAttribute defaultAttribute = processor.getAnnotation(DefaultAttribute.class); RubyHash defaultAttrs = RubyHash.newHash(rubyRuntime); defaultAttrs.put(defaultAttribute.key(), defaultAttribute.value()); rubyClass.callMethod(rubyRuntime.getCurrentContext(), "option", new IRubyObject[]{ rubyRuntime.newSymbol("default_attrs"), defaultAttrs }); } }
private static void handleDefaultAttributeAnnotation(Class<? extends Processor> processor, RubyClass rubyClass) { Ruby rubyRuntime = rubyClass.getRuntime(); if (processor.isAnnotationPresent(DefaultAttribute.class)) { DefaultAttribute defaultAttribute = processor.getAnnotation(DefaultAttribute.class); RubyHash defaultAttrs = RubyHash.newHash(rubyRuntime); defaultAttrs.put(defaultAttribute.key(), defaultAttribute.value()); rubyClass.callMethod(rubyRuntime.getCurrentContext(), "option", new IRubyObject[]{ rubyRuntime.newSymbol("default_attrs"), defaultAttrs }); } }
private static void handleDefaultAttributesAnnotation(Class<? extends Processor> processor, RubyClass rubyClass) { Ruby rubyRuntime = rubyClass.getRuntime(); if (processor.isAnnotationPresent(DefaultAttributes.class)) { DefaultAttributes defaultAttributes = processor.getAnnotation(DefaultAttributes.class); RubyHash defaultAttrs = RubyHash.newHash(rubyRuntime); for (DefaultAttribute defaultAttribute : defaultAttributes.value()) { defaultAttrs.put(defaultAttribute.key(), defaultAttribute.value()); } rubyClass.callMethod(rubyRuntime.getCurrentContext(), "option", new IRubyObject[]{ rubyRuntime.newSymbol("default_attrs"), defaultAttrs }); } }
@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; }
private static void handleDefaultAttributesAnnotation(Class<? extends Processor> processor, RubyClass rubyClass) { Ruby rubyRuntime = rubyClass.getRuntime(); if (processor.isAnnotationPresent(DefaultAttributes.class)) { DefaultAttributes defaultAttributes = processor.getAnnotation(DefaultAttributes.class); RubyHash defaultAttrs = RubyHash.newHash(rubyRuntime); for (DefaultAttribute defaultAttribute : defaultAttributes.value()) { defaultAttrs.put(defaultAttribute.key(), defaultAttribute.value()); } rubyClass.callMethod(rubyRuntime.getCurrentContext(), "option", new IRubyObject[]{ rubyRuntime.newSymbol("default_attrs"), defaultAttrs }); } }
@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; }
@Override public Title getStructuredDoctitle() { Ruby runtime = getRubyObject().getRuntime(); RubyHash options = RubyHash.newHash(runtime); RubySymbol partitioned = RubySymbol.newSymbol(runtime, "partition"); options.put(partitioned, RubyBoolean.newBoolean(runtime, true)); Object doctitle = getRubyProperty("doctitle", options); return toJava((IRubyObject) doctitle, Title.class); }
/** * Creates an inner document for the given parent document. * Inner documents are used for tables cells with style {@code asciidoc}. * * @param parentDocument The parent document of the new document. * @return A new inner document. */ @Override public Document createDocument(Document parentDocument) { Ruby runtime = JRubyRuntimeContext.get(parentDocument); RubyHash options = RubyHash.newHash(runtime); options.put( runtime.newSymbol("parent"), ((DocumentImpl) parentDocument).getRubyObject()); return (Document) NodeConverter.createASTNode(runtime, DOCUMENT_CLASS, runtime.getNil(), options); }
@Override public Title getStructuredDoctitle() { Ruby runtime = getRubyObject().getRuntime(); RubyHash options = RubyHash.newHash(runtime); RubySymbol partitioned = RubySymbol.newSymbol(runtime, "partition"); options.put(partitioned, RubyBoolean.newBoolean(runtime, true)); Object doctitle = getRubyProperty("doctitle", options); return toJava((IRubyObject) doctitle, Title.class); }