mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
random.c: Random.extend Formatter
* random.c (InitVM_Random): extend Random itself by Formatter module, as well as the `bytes` method used by the module. [Feature #4938] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62595 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
3406c5d613
commit
2af1761466
1 changed files with 1 additions and 0 deletions
1
random.c
1
random.c
|
@ -1671,6 +1671,7 @@ InitVM_Random(void)
|
||||||
/* Format raw random number as Random does */
|
/* Format raw random number as Random does */
|
||||||
VALUE m = rb_define_module_under(rb_cRandom, "Formatter");
|
VALUE m = rb_define_module_under(rb_cRandom, "Formatter");
|
||||||
rb_include_module(rb_cRandom, m);
|
rb_include_module(rb_cRandom, m);
|
||||||
|
rb_extend_object(rb_cRandom, m);
|
||||||
rb_define_method(m, "random_number", rand_random_number, -1);
|
rb_define_method(m, "random_number", rand_random_number, -1);
|
||||||
rb_define_method(m, "rand", rand_random_number, -1);
|
rb_define_method(m, "rand", rand_random_number, -1);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue