Implement argument type check for Tox#initialize
This commit is contained in:
parent
d97ef9a620
commit
beb90a36be
1 changed files with 3 additions and 1 deletions
|
@ -54,7 +54,9 @@ VALUE cTox_initialize(const VALUE self, const VALUE options)
|
||||||
cTox_ *tox;
|
cTox_ *tox;
|
||||||
cTox_cOptions_ *tox_options;
|
cTox_cOptions_ *tox_options;
|
||||||
|
|
||||||
/* check if `options` is instance of `Tox::Options` */
|
// check if `options` is instance of `Tox::Options`
|
||||||
|
if (Qfalse == rb_funcall(options, rb_intern("is_a?"), 1, cTox_cOptions))
|
||||||
|
rb_raise(rb_eTypeError, "argument 1 should be Tox::Options");
|
||||||
|
|
||||||
Data_Get_Struct(self, cTox_, tox);
|
Data_Get_Struct(self, cTox_, tox);
|
||||||
Data_Get_Struct(options, cTox_cOptions_, tox_options);
|
Data_Get_Struct(options, cTox_cOptions_, tox_options);
|
||||||
|
|
Reference in a new issue