Sha256: 9e4182151c5ac8cd32a65b3c104c30bb1a50cb5c0be3ff7f720206b3d3d90baf

Contents?: true

Size: 794 Bytes

Versions: 6

Compression:

Stored size: 794 Bytes

Contents

#include "classpath.h"

VALUE
class2path(klass)
    VALUE klass;
{
    VALUE path = rb_class_path(klass);
    char *n = RSTRING(path)->ptr;

    if (n[0] == '#') {
	rb_raise(rb_eTypeError, "can't dump anonymous %s %s",
		 (TYPE(klass) == T_CLASS ? "class" : "module"),
		 n);
    }
    if (rb_path2class(n) != rb_class_real(klass)) {
	rb_raise(rb_eTypeError, "%s cannot be referred", n);
    }
    return path;
}

VALUE
path2class(path)
    char *path;
{
    VALUE v = rb_path2class(path);

    if (TYPE(v) != T_CLASS) {
	rb_raise(rb_eArgError, "%s does not refer class", path);
    }
    return v;
}

VALUE
path2module(path)
    char *path;
{
    VALUE v = rb_path2class(path);

    if (TYPE(v) != T_MODULE) {
	rb_raise(rb_eArgError, "%s does not refer module", path);
    }
    return v;
}


Version data entries

6 entries across 6 versions & 2 rubygems

Version Path
ruby-internal-0.7.3 ext/cached/ruby-1.8.2/internal/module/classpath.c
ruby-internal-0.7.2 ext/cached/ruby-1.8.2/internal/module/classpath.c
ruby-internal-0.7.1 ext/cached/ruby-1.8.2/internal/module/classpath.c
ruby-internal-0.7.0 ext/cached/ruby-1.8.2/internal/module/classpath.c
ruby-internal-0.6.0 ext/cached/ruby-1.8.2/internal/module/classpath.c
nodewrap-0.5.0 ext/cached/ruby-1.8.2/classpath.c