}
@JRubyMethod()
public IRubyObject each(ThreadContext context, Block block) {
Ruby runtime = context.getRuntime();
EnumVariant enumVariant = dispatch.toEnumVariant();
// FIXME: when no block is passed handling
while (enumVariant.hasMoreElements()) {
Variant value = enumVariant.nextElement();
block.yield(context, fromVariant(runtime, value));
}
enumVariant.safeRelease();
return runtime.getNil();
}