Skip to content

Instantly share code, notes, and snippets.

Created December 21, 2011 01:47
Show Gist options
  • Save anonymous/1504178 to your computer and use it in GitHub Desktop.
Save anonymous/1504178 to your computer and use it in GitHub Desktop.
diff --git a/.idea/libraries/Maven__org_jruby_extras_bytelist_1_0_9.xml b/.idea/libraries/Maven__org_jruby_extras_bytelist_1_0_9.xml
index f9291b2..7c4726f 100644
--- a/.idea/libraries/Maven__org_jruby_extras_bytelist_1_0_9.xml
+++ b/.idea/libraries/Maven__org_jruby_extras_bytelist_1_0_9.xml
@@ -10,4 +10,4 @@
<root url="jar://$MAVEN_REPOSITORY$/org/jruby/extras/bytelist/1.0.9/bytelist-1.0.9-sources.jar!/" />
</SOURCES>
</library>
-</component>
+</component>
\ No newline at end of file
diff --git a/src/org/jruby/RubyYielder.java b/src/org/jruby/RubyYielder.java
index f640859..8127260 100644
--- a/src/org/jruby/RubyYielder.java
+++ b/src/org/jruby/RubyYielder.java
@@ -36,7 +36,7 @@ import org.jruby.runtime.builtin.IRubyObject;
@JRubyClass(name = "Enumerator::Yielder")
public class RubyYielder extends RubyObject {
- private RubyProc proc;
+ private Block block;
public static RubyClass createYielderClass(Ruby runtime) {
RubyClass yielderc = runtime.defineClassUnder("Yielder", runtime.getObject(), YIELDER_ALLOCATOR, runtime.getEnumerator());
@@ -68,25 +68,25 @@ public class RubyYielder extends RubyObject {
}
private void checkInit() {
- if (proc == null) throw getRuntime().newArgumentError("uninitializer yielder");
+ if (block == null) throw getRuntime().newArgumentError("uninitialized yielder");
}
@JRubyMethod(visibility = PRIVATE)
public IRubyObject initialize(ThreadContext context, Block block) {
Ruby runtime = context.getRuntime();
if (!block.isGiven()) throw runtime.newLocalJumpErrorNoBlock();
- proc = runtime.newProc(Block.Type.PROC, block);
+ this.block = block;
return this;
}
@JRubyMethod(rest = true)
- public IRubyObject yield(ThreadContext context, IRubyObject[]args) {
+ public IRubyObject yield(ThreadContext context, IRubyObject[] args) {
checkInit();
- return proc.call(context, args);
+ return block.call(context, args);
}
@JRubyMethod(name = "<<", rest = true)
- public IRubyObject op_lshift(ThreadContext context, IRubyObject[]args) {
+ public IRubyObject op_lshift(ThreadContext context, IRubyObject[] args) {
yield(context, args);
return this;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment