Skip to content

Commit

Permalink
Whoops main part of patch missing from last commit
Browse files Browse the repository at this point in the history
  • Loading branch information
enebo committed May 19, 2009
1 parent c6e784f commit 59a4474
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
1 change: 0 additions & 1 deletion spec/tags/ruby/core/marshal/load_tags.txt

This file was deleted.

3 changes: 2 additions & 1 deletion src/org/jruby/RubyMethod.java
Expand Up @@ -41,6 +41,7 @@
import org.jruby.runtime.ObjectAllocator;
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.runtime.marshal.DataType;

/**
* The RubyMethod class represents a RubyMethod object.
Expand All @@ -53,7 +54,7 @@
* @since 0.2.3
*/
@JRubyClass(name="Method")
public class RubyMethod extends RubyObject {
public class RubyMethod extends RubyObject implements DataType {
protected RubyModule implementationModule;
protected String methodName;
protected RubyModule originModule;
Expand Down
7 changes: 6 additions & 1 deletion src/org/jruby/RubyProc.java
Expand Up @@ -49,12 +49,13 @@
import org.jruby.runtime.ThreadContext;
import org.jruby.runtime.Visibility;
import org.jruby.runtime.builtin.IRubyObject;
import org.jruby.runtime.marshal.DataType;

/**
* @author jpetersen
*/
@JRubyClass(name="Proc")
public class RubyProc extends RubyObject implements JumpTarget {
public class RubyProc extends RubyObject implements JumpTarget, DataType {
private Block block = Block.NULL_BLOCK;
private Block.Type type;
private String file;
Expand Down Expand Up @@ -153,6 +154,7 @@ public IRubyObject initialize(ThreadContext context, Block procBlock) {
}

@JRubyMethod(name = "clone")
@Override
public IRubyObject rbClone() {
RubyProc newProc = new RubyProc(getRuntime(), getRuntime().getProc(), type);
newProc.block = getBlock();
Expand All @@ -163,6 +165,7 @@ public IRubyObject rbClone() {
}

@JRubyMethod(name = "dup")
@Override
public IRubyObject dup() {
RubyProc newProc = new RubyProc(getRuntime(), getRuntime().getProc(), type);
newProc.block = getBlock();
Expand All @@ -183,6 +186,7 @@ public IRubyObject op_equal(IRubyObject other) {
}

@JRubyMethod(name = "to_s")
@Override
public IRubyObject to_s() {
return RubyString.newString(getRuntime(),
"#<Proc:0x" + Integer.toString(block.hashCode(), 16) + "@" +
Expand Down Expand Up @@ -265,6 +269,7 @@ public RubyProc to_proc() {
return this;
}

@Override
public IRubyObject as(Class asClass) {
final Ruby ruby = getRuntime();
if (!asClass.isInterface()) {
Expand Down
3 changes: 3 additions & 0 deletions src/org/jruby/runtime/marshal/MarshalStream.java
Expand Up @@ -203,6 +203,9 @@ private void writeObjectData(IRubyObject value) throws IOException {
// classes that have extended core native types to piggyback on their
// marshalling logic.
if (value instanceof CoreObjectType) {
if (value instanceof DataType) {
throw value.getRuntime().newTypeError("no marshal_dump is defined for class " + value.getMetaClass().getName());
}
int nativeTypeIndex = ((CoreObjectType)value).getNativeTypeIndex();

switch (nativeTypeIndex) {
Expand Down

0 comments on commit 59a4474

Please sign in to comment.