private Object lookupRestKeywordArgumentHash(VirtualFrame frame) { CompilerDirectives.transferToInterpreter(); final DynamicObject hash = RubyArguments.getUserKeywordsHash(frame.getArguments(), minimum); if (hash == null) { return Layouts.HASH.createHash( getContext().getCoreLibrary().getHashFactory(), null, null, null, 0, null, null, false); } final List<Map.Entry<Object, Object>> entries = new ArrayList<>(); outer: for (Map.Entry<Object, Object> keyValue : HashOperations.iterableKeyValues(hash)) { for (String excludedKeyword : excludedKeywords) { if (excludedKeyword.equals(keyValue.getKey().toString())) { continue outer; } } entries.add(keyValue); } return BucketsStrategy.create(getContext(), entries, Layouts.HASH.getCompareByIdentity(hash)); }
@CompilerDirectives.TruffleBoundary private Object lookupKeywordInHash(RubyHash hash) { for (KeyValue keyValue : HashOperations.verySlowToKeyValues(hash)) { if (keyValue.getKey().toString().equals(name)) { return keyValue.getValue(); } } return null; }