private void handleDocumentStart(ThreadContext context, DocumentStartEvent dse, boolean tainted, IRubyObject handler) { Ruby runtime = context.runtime; DumperOptions.Version _version = dse.getVersion(); Integer[] versionInts = _version == null ? null : _version.getArray(); IRubyObject version = versionInts == null ? RubyArray.newArray(runtime) : RubyArray.newArray(runtime, runtime.newFixnum(versionInts[0]), runtime.newFixnum(versionInts[1])); Map<String, String> tagsMap = dse.getTags(); RubyArray tags = RubyArray.newArray(runtime); if (tagsMap != null && tagsMap.size() > 0) { for (Map.Entry<String, String> tag : tagsMap.entrySet()) { IRubyObject key = stringFor(runtime, tag.getKey(), tainted); IRubyObject value = stringFor(runtime, tag.getValue(), tainted); tags.append(RubyArray.newArray(runtime, key, value)); } } IRubyObject notExplicit = runtime.newBoolean(!dse.getExplicit()); invoke(context, handler, "start_document", version, tags, notExplicit); }
private void handleDocumentStart(ThreadContext context, DocumentStartEvent dse, boolean tainted, IRubyObject handler) { Ruby runtime = context.runtime; DumperOptions.Version _version = dse.getVersion(); Integer[] versionInts = _version == null ? null : _version.getArray(); IRubyObject version = versionInts == null ? RubyArray.newArray(runtime) : RubyArray.newArray(runtime, runtime.newFixnum(versionInts[0]), runtime.newFixnum(versionInts[1])); Map<String, String> tagsMap = dse.getTags(); RubyArray tags = RubyArray.newArray(runtime); if (tagsMap != null && tagsMap.size() > 0) { for (Map.Entry<String, String> tag : tagsMap.entrySet()) { IRubyObject key = stringFor(runtime, tag.getKey(), tainted); IRubyObject value = stringFor(runtime, tag.getValue(), tainted); tags.append(RubyArray.newArray(runtime, key, value)); } } IRubyObject notExplicit = runtime.newBoolean(!dse.getExplicit()); invoke(context, handler, "start_document", version, tags, notExplicit); }
@Override public String toString() { return "Version: " + getRepresentation(); } }
private String prepareVersion(Version version) { if (version.major() != 1) { throw new EmitterException("unsupported YAML version: " + version); } return version.getRepresentation(); }
private String prepareVersion(Version version) { if (version.major() != 1) { throw new EmitterException("unsupported YAML version: " + version); } return version.getRepresentation(); }
@Override public String toString() { return "Version: " + getRepresentation(); } }
@Override public String toString() { return "Version: " + getRepresentation(); } }
private String prepareVersion(Version version) { if (version.major() != 1) { throw new EmitterException("unsupported YAML version: " + version); } return version.getRepresentation(); }
@Override public String toString() { return "Version: " + getRepresentation(); } }
private String prepareVersion(Version version) { if (version.major() != 1) { throw new EmitterException("unsupported YAML version: " + version); } return version.getRepresentation(); }