Ruby  3.1.0dev(2021-09-10revisionb76ad15ed0da636161de0243c547ee1e6fc95681)
psych.c
Go to the documentation of this file.
1 #include <psych.h>
2 
3 /* call-seq: Psych.libyaml_version
4  *
5  * Returns the version of libyaml being used
6  */
7 static VALUE libyaml_version(VALUE module)
8 {
9  int major, minor, patch;
10  VALUE list[3];
11 
12  yaml_get_version(&major, &minor, &patch);
13 
14  list[0] = INT2NUM(major);
15  list[1] = INT2NUM(minor);
16  list[2] = INT2NUM(patch);
17 
18  return rb_ary_new4((long)3, list);
19 }
20 
22 
23 void Init_psych(void)
24 {
25  #ifdef HAVE_RB_EXT_RACTOR_SAFE
26  RB_EXT_RACTOR_SAFE(true);
27  #endif
28  mPsych = rb_define_module("Psych");
29 
30  rb_define_singleton_method(mPsych, "libyaml_version", libyaml_version, 0);
31 
36 }
37 /* vim: set noet sws=4 sw=4: */
rb_define_singleton_method
#define rb_define_singleton_method(klass, mid, func, arity)
Defines klass.mid.
Definition: cxxanyargs.hpp:670
RB_EXT_RACTOR_SAFE
#define RB_EXT_RACTOR_SAFE(f)
Definition: load.h:39
Init_psych_yaml_tree
void Init_psych_yaml_tree(void)
Definition: psych_yaml_tree.c:5
rb_define_module
VALUE rb_define_module(const char *name)
Definition: class.c:887
Init_psych_to_ruby
void Init_psych_to_ruby(void)
Definition: psych_to_ruby.c:27
psych.h
Init_psych_emitter
void Init_psych_emitter(void)
Definition: psych_emitter.c:522
Init_psych_parser
void Init_psych_parser(void)
Definition: psych_parser.c:537
INT2NUM
#define INT2NUM
Definition: int.h:43
VALUE
unsigned long VALUE
Definition: value.h:38
Init_psych
void Init_psych(void)
Definition: psych.c:23
mPsych
VALUE mPsych
Definition: psych.c:21
rb_ary_new4
#define rb_ary_new4
Definition: array.h:74