summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNobuyoshi Nakada <[email protected]>2024-12-13 10:47:22 +0900
committerNobuyoshi Nakada <[email protected]>2024-12-25 19:12:31 +0900
commit8f11d6cbe2e86d5e6f80911024630aa0d3685332 ()
tree028a3d1c58e81d5a00ec327c8e7a29adf57b932a
parentb923a59b8e189fb1a044d13840696d0fb33621bc (diff)
Show docs of constants under Ruby
Notes: Merged: https://.com/ruby/ruby/pull/12451
-rw-r--r--version.c36
1 files changed, 20 insertions, 16 deletions
@@ -88,17 +88,18 @@ const char ruby_engine[] = "ruby";
const char *rb_dynamic_description = ruby_description;
static inline void
-define_ruby_const(const char *name, VALUE value, VALUE mRuby)
{
- rb_define_global_const(name, value);
- if (strncmp(name, "RUBY_", rb_strlen_lit("RUBY_")) == 0) {
- rb_define_const(mRuby, name + rb_strlen_lit("RUBY_"), value);
}
}
-/* RDoc needs rb_define_global_const */
-#define rb_define_global_const(name, value) \
- define_ruby_const(name, value, mRuby)
/*! Defines platform-depended Ruby-level constants */
void
@@ -107,6 +108,9 @@ Init_version(void)
/*
* The Ruby module that contains portable information among
* implementations.
*/
VALUE mRuby = rb_define_module("Ruby");
@@ -118,37 +122,37 @@ Init_version(void)
/*
* The running version of ruby
*/
- rb_define_global_const("RUBY_VERSION", /* MKSTR(version) */ version);
/*
* The date this ruby was released
*/
- rb_define_global_const("RUBY_RELEASE_DATE", MKSTR(release_date));
/*
* The platform for this ruby
*/
- rb_define_global_const("RUBY_PLATFORM", MKSTR(platform));
/*
* The level for this ruby. If this is a development build of ruby
* the level will be -1
*/
- rb_define_global_const("RUBY_LEVEL", MKINT(level));
/*
* The GIT commit hash for this ruby.
*/
- rb_define_global_const("RUBY_REVISION", MKSTR(revision));
/*
* The copyright string for ruby
*/
- rb_define_global_const("RUBY_COPYRIGHT", MKSTR(copyright));
/*
* The engine or interpreter this ruby uses.
*/
- rb_define_global_const("RUBY_ENGINE", /* MKSTR(engine) */ ruby_engine_name);
ruby_set_script_name(ruby_engine_name);
/*
* The version of the engine or interpreter this ruby uses.
*/
- rb_define_global_const("RUBY_ENGINE_VERSION", /* MKSTR(version) */ version);
rb_provide("ruby2_keywords.rb");
}
@@ -227,7 +231,7 @@ define_ruby_description(const char *const jit_opt)
/*
* The full ruby version string, like <tt>ruby -v</tt> prints
*/
- rb_define_global_const("RUBY_DESCRIPTION", /* MKSTR(description) */ description);
}
void