Ruby  2.0.0p451(2014-02-24revision45167)
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((long)major);
15  list[1] = INT2NUM((long)minor);
16  list[2] = INT2NUM((long)patch);
17 
18  return rb_ary_new4((long)3, list);
19 }
20 
22 
23 void Init_psych()
24 {
25  mPsych = rb_define_module("Psych");
26 
27  rb_define_singleton_method(mPsych, "libyaml_version", libyaml_version, 0);
28 
33 }
34 /* vim: set noet sws=4 sw=4: */
VALUE rb_ary_new4(long n, const VALUE *elts)
Definition: array.c:451
unsigned long VALUE
Definition: ripper.y:104
int minor
Definition: tcltklib.c:110
void rb_define_singleton_method(VALUE obj, const char *name, VALUE(*func)(ANYARGS), int argc)
Defines a singleton method for obj.
Definition: class.c:1497
void Init_psych_parser()
Definition: psych_parser.c:538
void Init_psych_yaml_tree(void)
void Init_psych_to_ruby(void)
Definition: psych_to_ruby.c:31
#define INT2NUM(x)
struct rb_encoding_entry * list
Definition: encoding.c:50
VALUE mPsych
Definition: psych.c:21
void Init_psych()
Definition: psych.c:23
yaml_get_version(int *major, int *minor, int *patch)
Get the library version numbers.
Definition: api.c:19
int major
Definition: tcltklib.c:109
void Init_psych_emitter()
VALUE rb_define_module(const char *name)
Definition: class.c:617
static VALUE libyaml_version(VALUE module)
Definition: psych.c:7