Sha256: ec9e2391f91dbc8209f3d652598b50c18662a82f3c32b0d6fb78e11d83055547

Contents?: true

Size: 795 Bytes

Versions: 24

Compression:

Stored size: 795 Bytes

Contents

#include "classpath.h"

VALUE
class2path(VALUE klass)
{
    VALUE path = rb_class_path(klass);
    const char *n;

    n = must_not_be_anonymous((TYPE(klass) == T_CLASS ? "class" : "module"), path);
    if (rb_path_to_class(path) != rb_class_real(klass)) {
	rb_raise(rb_eTypeError, "%s can't be referred to", n);
    }
    return path;
}

VALUE
path2class(VALUE path)
{
    VALUE v = rb_path_to_class(path);

    if (TYPE(v) != T_CLASS) {
	rb_raise(rb_eArgError, "%.*s does not refer to class",
		 (int)RSTRING_LEN(path), RSTRING_PTR(path));
    }
    return v;
}

VALUE
path2module(VALUE path)
{
    VALUE v = rb_path_to_class(path);

    if (TYPE(v) != T_MODULE) {
	rb_raise(rb_eArgError, "%.*s does not refer to module",
		 (int)RSTRING_LEN(path), RSTRING_PTR(path));
    }
    return v;
}


Version data entries

24 entries across 7 versions & 1 rubygems

Version Path
ruby-internal-0.8.5 ext/internal/module/classpath.c
ruby-internal-0.8.5 ext/cached/ruby-1.9.1/internal/module/classpath.c
ruby-internal-0.8.5 ext/cached/ruby-1.9.3/internal/module/classpath.c
ruby-internal-0.8.5 ext/cached/ruby-1.9.2/internal/module/classpath.c
ruby-internal-0.8.4 ext/cached/ruby-1.9.2/internal/module/classpath.c
ruby-internal-0.8.4 ext/cached/ruby-1.9.1/internal/module/classpath.c
ruby-internal-0.8.4 ext/cached/ruby-1.9.3/internal/module/classpath.c
ruby-internal-0.8.4 ext/internal/module/classpath.c
ruby-internal-0.8.3 ext/internal/module/classpath.c
ruby-internal-0.8.3 ext/cached/ruby-1.9.2/internal/module/classpath.c
ruby-internal-0.8.3 ext/cached/ruby-1.9.3/internal/module/classpath.c
ruby-internal-0.8.3 ext/cached/ruby-1.9.1/internal/module/classpath.c
ruby-internal-0.8.2 ext/internal/module/classpath.c
ruby-internal-0.8.2 ext/cached/ruby-1.9.1/internal/module/classpath.c
ruby-internal-0.8.2 ext/cached/ruby-1.9.3/internal/module/classpath.c
ruby-internal-0.8.2 ext/cached/ruby-1.9.2/internal/module/classpath.c
ruby-internal-0.8.1 ext/cached/ruby-1.9.3/internal/module/classpath.c
ruby-internal-0.8.1 ext/cached/ruby-1.9.1/internal/module/classpath.c
ruby-internal-0.8.1 ext/cached/ruby-1.9.2/internal/module/classpath.c
ruby-internal-0.8.1 ext/internal/module/classpath.c