Search in sources :

Example 6 with RubyHash

use of org.jruby.RubyHash in project nokogiri by sparklemotion.

the class ReaderNode method getNamespaces.

public IRubyObject getNamespaces(ThreadContext context) {
    final Ruby runtime = context.runtime;
    if (namespaces == null)
        return runtime.getNil();
    RubyHash hash = RubyHash.newHash(runtime);
    for (Map.Entry<String, String> entry : namespaces.entrySet()) {
        IRubyObject k = stringOrBlank(runtime, entry.getKey());
        IRubyObject v = stringOrBlank(runtime, entry.getValue());
        // hash.op_aset(context, k, v)
        hash.fastASetCheckString(runtime, k, v);
    }
    return hash;
}
Also used : RubyHash(org.jruby.RubyHash) NokogiriHelpers.rubyStringToString(nokogiri.internals.NokogiriHelpers.rubyStringToString) IRubyObject(org.jruby.runtime.builtin.IRubyObject) Ruby(org.jruby.Ruby) HashMap(java.util.HashMap) Map(java.util.Map)

Aggregations

RubyHash (org.jruby.RubyHash)6 IRubyObject (org.jruby.runtime.builtin.IRubyObject)4 Map (java.util.Map)2 NokogiriHelpers.rubyStringToString (nokogiri.internals.NokogiriHelpers.rubyStringToString)2 Ruby (org.jruby.Ruby)2 HashMap (java.util.HashMap)1 Iterator (java.util.Iterator)1 ScriptContext (javax.script.ScriptContext)1 ScriptEngine (javax.script.ScriptEngine)1 ScriptException (javax.script.ScriptException)1 RubyArray (org.jruby.RubyArray)1 PyDictionary (org.python.core.PyDictionary)1