示例#1
0
文件: HashNodes.java 项目: phs/jruby
    @Specialization
    public NilPlaceholder each(VirtualFrame frame, RubyHash hash, RubyProc block) {
      for (Map.Entry<Object, Object> entry : hash.storage.entrySet()) {
        yield(frame, block, entry.getKey(), entry.getValue());
      }

      return NilPlaceholder.INSTANCE;
    }
示例#2
0
文件: HashNodes.java 项目: phs/jruby
    @Specialization
    public RubyArray map(VirtualFrame frame, RubyHash hash, RubyProc block) {
      final RubyArray result = new RubyArray(getContext().getCoreLibrary().getArrayClass());

      for (Map.Entry<Object, Object> entry : hash.storage.entrySet()) {
        result.push(yield(frame, block, entry.getKey(), entry.getValue()));
      }

      return result;
    }