Sha256: 3aefb531afe09110eb2f0db895b30a2e565bc0dce8c0a72d0a683cdca7af629a

Contents?: true

Size: 1.28 KB

Versions: 35

Compression:

Stored size: 1.28 KB

Contents

#include "Module.hpp"
#include "Symbol.hpp"
#include "String.hpp"
#include "Array.hpp"
#include "Exception.hpp"
#include "protect.hpp"

Rice::Module::
Module()
  : Module_impl<Module_base, Module>(rb_cObject)
{
}

Rice::Module::
Module(VALUE v)
  : Module_impl<Module_base, Module>(v)
{
  if(::rb_type(v) != T_CLASS && ::rb_type(v) != T_MODULE)
  {
    throw Exception(
        rb_eTypeError,
        "Expected a Module but got a %s",
        rb_class2name(CLASS_OF(v))); // TODO: might raise an exception
  }
}

Rice::String Rice::Module::
name() const
{
  Object name = rb_mod_name(*this);
  if(name.is_nil())
  {
    // 1.9
    return String("");
  }
  else
  {
    return name;
  }
}

Rice::Module Rice::
define_module_under(
    Rice::Object module,
    char const * name)
{
  VALUE v = rb_define_module_under(module, name);
  return Module(v);
}

Rice::Module Rice::
define_module(
    char const * name)
{
  VALUE v = rb_define_module(name);
  return Module(v);
}

Rice::Module Rice::
anonymous_module()
{
  return Module(protect(rb_module_new));
}

void Rice::Module::
swap(Rice::Module & other)
{
  Module_base::swap(other);
}

Rice::Array
Rice::Module::
ancestors() const
{
  return protect(rb_mod_ancestors, *this);
}

Rice::Class
Rice::Module::
singleton_class() const
{
  return CLASS_OF(value());
}

Version data entries

35 entries across 35 versions & 6 rubygems

Version Path
rice-3.0.0 rice/Module.cpp
rice2-2.2.1 rice/Module.cpp
rice2-2.2.0 rice/Module.cpp
rice-2.2.0 rice/Module.cpp
rice-2.1.3 rice/Module.cpp
rice-2.1.2 rice/Module.cpp
rice-2.1.1 rice/Module.cpp
rice-2.1.0 rice/Module.cpp
rice-2.0.0 rice/Module.cpp
rice-1.7.0 rice/Module.cpp
rice-1.6.3 rice/Module.cpp
jameskilton-rice-1.2.0 rice/Module.cpp
rice-1.6.2 rice/Module.cpp
rice-1.6.1 rice/Module.cpp
rice-1.6.0 rice/Module.cpp
rice-1.6.0.pre rice/Module.cpp
rice-1.5.3 rice/Module.cpp
rice-1.5.2 rice/Module.cpp
keyme-rice-1.5.1.keyme1 rice/Module.cpp
keyme-rice-1.5.1.keyme rice/Module.cpp