mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
untabify [ci skip]
based on the patch by W <wolf@wolfsden.cz> [Fix GH-1497] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@57006 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
0f0c388a0e
commit
adef6efcde
2 changed files with 14 additions and 14 deletions
|
@ -423,9 +423,9 @@ argcが-1の時は引数を配列に入れて渡されます.argcが-2の時
|
||||||
private/protectedなメソッドを定義するふたつの関数があります.
|
private/protectedなメソッドを定義するふたつの関数があります.
|
||||||
|
|
||||||
void rb_define_private_method(VALUE klass, const char *name,
|
void rb_define_private_method(VALUE klass, const char *name,
|
||||||
VALUE (*func)(), int argc)
|
VALUE (*func)(), int argc)
|
||||||
void rb_define_protected_method(VALUE klass, const char *name,
|
void rb_define_protected_method(VALUE klass, const char *name,
|
||||||
VALUE (*func)(), int argc)
|
VALUE (*func)(), int argc)
|
||||||
|
|
||||||
privateメソッドとは関数形式でしか呼び出すことの出来ないメソッ
|
privateメソッドとは関数形式でしか呼び出すことの出来ないメソッ
|
||||||
ドです.
|
ドです.
|
||||||
|
@ -446,7 +446,7 @@ privateメソッドでもあるものです.例をあげるとMathモジュー
|
||||||
通りです.
|
通りです.
|
||||||
|
|
||||||
void rb_define_module_function(VALUE module, const char *name,
|
void rb_define_module_function(VALUE module, const char *name,
|
||||||
VALUE (*func)(), int argc)
|
VALUE (*func)(), int argc)
|
||||||
|
|
||||||
関数的メソッド(Kernelモジュールのprivate method)を定義するた
|
関数的メソッド(Kernelモジュールのprivate method)を定義するた
|
||||||
めの関数は以下の通りです.
|
めの関数は以下の通りです.
|
||||||
|
@ -642,7 +642,7 @@ CとRubyで大域変数を使って情報を共有できます.共有できる
|
||||||
値の参照や設定はhookで行う必要があります.
|
値の参照や設定はhookで行う必要があります.
|
||||||
|
|
||||||
void rb_define_hooked_variable(const char *name, VALUE *var,
|
void rb_define_hooked_variable(const char *name, VALUE *var,
|
||||||
VALUE (*getter)(), void (*setter)())
|
VALUE (*getter)(), void (*setter)())
|
||||||
|
|
||||||
この関数はCの関数によってhookのつけられた大域変数を定義しま
|
この関数はCの関数によってhookのつけられた大域変数を定義しま
|
||||||
す.変数が参照された時には関数getterが,変数に値がセットされ
|
す.変数が参照された時には関数getterが,変数に値がセットされ
|
||||||
|
@ -662,7 +662,7 @@ getterとsetterの仕様は次の通りです.
|
||||||
されます.
|
されます.
|
||||||
|
|
||||||
void rb_define_virtual_variable(const char *name,
|
void rb_define_virtual_variable(const char *name,
|
||||||
VALUE (*getter)(), void (*setter)())
|
VALUE (*getter)(), void (*setter)())
|
||||||
|
|
||||||
この関数によって定義されたRubyの大域変数が参照された時には
|
この関数によって定義されたRubyの大域変数が参照された時には
|
||||||
getterが,変数に値がセットされた時にはsetterが呼ばれます.
|
getterが,変数に値がセットされた時にはsetterが呼ばれます.
|
||||||
|
@ -923,7 +923,7 @@ fdbm_delete()はこのようになっています.
|
||||||
/* ... */
|
/* ... */
|
||||||
|
|
||||||
if (rb_scan_args(argc, argv, "11", &file, &vmode) == 1) {
|
if (rb_scan_args(argc, argv, "11", &file, &vmode) == 1) {
|
||||||
mode = 0666; /* default value */
|
mode = 0666; /* default value */
|
||||||
}
|
}
|
||||||
|
|
||||||
/* ... */
|
/* ... */
|
||||||
|
|
|
@ -361,10 +361,10 @@ To define nested classes or modules, use the functions below:
|
||||||
To define methods or singleton methods, use these functions:
|
To define methods or singleton methods, use these functions:
|
||||||
|
|
||||||
void rb_define_method(VALUE klass, const char *name,
|
void rb_define_method(VALUE klass, const char *name,
|
||||||
VALUE (*func)(), int argc)
|
VALUE (*func)(), int argc)
|
||||||
|
|
||||||
void rb_define_singleton_method(VALUE object, const char *name,
|
void rb_define_singleton_method(VALUE object, const char *name,
|
||||||
VALUE (*func)(), int argc)
|
VALUE (*func)(), int argc)
|
||||||
|
|
||||||
The `argc' represents the number of the arguments to the C function,
|
The `argc' represents the number of the arguments to the C function,
|
||||||
which must be less than 17. But I doubt you'll need that many.
|
which must be less than 17. But I doubt you'll need that many.
|
||||||
|
@ -396,9 +396,9 @@ as the name of method to be defined. See also ID or Symbol below.
|
||||||
There are two functions to define private/protected methods:
|
There are two functions to define private/protected methods:
|
||||||
|
|
||||||
void rb_define_private_method(VALUE klass, const char *name,
|
void rb_define_private_method(VALUE klass, const char *name,
|
||||||
VALUE (*func)(), int argc)
|
VALUE (*func)(), int argc)
|
||||||
void rb_define_protected_method(VALUE klass, const char *name,
|
void rb_define_protected_method(VALUE klass, const char *name,
|
||||||
VALUE (*func)(), int argc)
|
VALUE (*func)(), int argc)
|
||||||
|
|
||||||
At last, rb_define_module_function defines a module function,
|
At last, rb_define_module_function defines a module function,
|
||||||
which are private AND singleton methods of the module.
|
which are private AND singleton methods of the module.
|
||||||
|
@ -415,7 +415,7 @@ or
|
||||||
To define module functions, use:
|
To define module functions, use:
|
||||||
|
|
||||||
void rb_define_module_function(VALUE module, const char *name,
|
void rb_define_module_function(VALUE module, const char *name,
|
||||||
VALUE (*func)(), int argc)
|
VALUE (*func)(), int argc)
|
||||||
|
|
||||||
In addition, function-like methods, which are private methods defined
|
In addition, function-like methods, which are private methods defined
|
||||||
in the Kernel module, can be defined using:
|
in the Kernel module, can be defined using:
|
||||||
|
@ -596,7 +596,7 @@ You can define hooked variables. The accessor functions (getter and
|
||||||
setter) are called on access to the hooked variables.
|
setter) are called on access to the hooked variables.
|
||||||
|
|
||||||
void rb_define_hooked_variable(const char *name, VALUE *var,
|
void rb_define_hooked_variable(const char *name, VALUE *var,
|
||||||
VALUE (*getter)(), void (*setter)())
|
VALUE (*getter)(), void (*setter)())
|
||||||
|
|
||||||
If you need to supply either setter or getter, just supply 0 for the
|
If you need to supply either setter or getter, just supply 0 for the
|
||||||
hook you don't need. If both hooks are 0, rb_define_hooked_variable()
|
hook you don't need. If both hooks are 0, rb_define_hooked_variable()
|
||||||
|
@ -611,7 +611,7 @@ Also you can define a Ruby global variable without a corresponding C
|
||||||
variable. The value of the variable will be set/get only by hooks.
|
variable. The value of the variable will be set/get only by hooks.
|
||||||
|
|
||||||
void rb_define_virtual_variable(const char *name,
|
void rb_define_virtual_variable(const char *name,
|
||||||
VALUE (*getter)(), void (*setter)())
|
VALUE (*getter)(), void (*setter)())
|
||||||
|
|
||||||
The prototypes of the getter and setter functions are as follows:
|
The prototypes of the getter and setter functions are as follows:
|
||||||
|
|
||||||
|
@ -853,7 +853,7 @@ arguments like this:
|
||||||
{
|
{
|
||||||
/* ... */
|
/* ... */
|
||||||
if (rb_scan_args(argc, argv, "11", &file, &vmode) == 1) {
|
if (rb_scan_args(argc, argv, "11", &file, &vmode) == 1) {
|
||||||
mode = 0666; /* default value */
|
mode = 0666; /* default value */
|
||||||
}
|
}
|
||||||
/* ... */
|
/* ... */
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue