Sha256: 13c28bdaf2665a922f21b50f5a0da86ab829ded5759cbf04ac35d0e0babd783c

Contents?: true

Size: 805 Bytes

Versions: 12

Compression:

Stored size: 805 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 can't be referred", n);
    }
    return path;
}

VALUE
path2class(path)
    const 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)
    const 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

12 entries across 11 versions & 1 rubygems

Version Path
ruby-internal-0.8.5 ext/cached/ruby-1.8.7/internal/module/classpath.c
ruby-internal-0.8.4 ext/cached/ruby-1.8.7/internal/module/classpath.c
ruby-internal-0.8.3 ext/cached/ruby-1.8.7/internal/module/classpath.c
ruby-internal-0.8.2 ext/cached/ruby-1.8.7/internal/module/classpath.c
ruby-internal-0.8.1 ext/cached/ruby-1.8.7/internal/module/classpath.c
ruby-internal-0.8.0 ext/cached/ruby-1.8.7/internal/module/classpath.c
ruby-internal-0.8.0 ext/internal/module/classpath.c
ruby-internal-0.7.3 ext/cached/ruby-1.8.7/internal/module/classpath.c
ruby-internal-0.7.2 ext/cached/ruby-1.8.7/internal/module/classpath.c
ruby-internal-0.7.1 ext/cached/ruby-1.8.7/internal/module/classpath.c
ruby-internal-0.7.0 ext/cached/ruby-1.8.7/internal/module/classpath.c
ruby-internal-0.6.0 ext/cached/ruby-1.8.7/internal/module/classpath.c