Make options optional for Tox#initialize
This commit is contained in:
parent
a6cefab6f3
commit
872b2a8ee7
2 changed files with 9 additions and 3 deletions
|
@ -26,7 +26,7 @@ typedef struct cTox_ {
|
||||||
static VALUE cTox;
|
static VALUE cTox;
|
||||||
static VALUE cTox_alloc(VALUE klass);
|
static VALUE cTox_alloc(VALUE klass);
|
||||||
static void cTox_free(void *ptr);
|
static void cTox_free(void *ptr);
|
||||||
static VALUE cTox_initialize(VALUE self, VALUE options);
|
static VALUE cTox_initialize_with(VALUE self, VALUE options);
|
||||||
static VALUE cTox_savedata(VALUE self);
|
static VALUE cTox_savedata(VALUE self);
|
||||||
static VALUE cTox_id(VALUE self);
|
static VALUE cTox_id(VALUE self);
|
||||||
static VALUE cTox_bootstrap(VALUE self, VALUE options);
|
static VALUE cTox_bootstrap(VALUE self, VALUE options);
|
||||||
|
@ -44,7 +44,7 @@ void Init_tox()
|
||||||
{
|
{
|
||||||
cTox = rb_define_class("Tox", rb_cObject);
|
cTox = rb_define_class("Tox", rb_cObject);
|
||||||
rb_define_alloc_func(cTox, cTox_alloc);
|
rb_define_alloc_func(cTox, cTox_alloc);
|
||||||
rb_define_method(cTox, "initialize", cTox_initialize, 1);
|
rb_define_method(cTox, "initialize_with", cTox_initialize_with, 1);
|
||||||
rb_define_method(cTox, "savedata", cTox_savedata, 0);
|
rb_define_method(cTox, "savedata", cTox_savedata, 0);
|
||||||
rb_define_method(cTox, "id", cTox_id, 0);
|
rb_define_method(cTox, "id", cTox_id, 0);
|
||||||
rb_define_method(cTox, "bootstrap", cTox_bootstrap, 1);
|
rb_define_method(cTox, "bootstrap", cTox_bootstrap, 1);
|
||||||
|
@ -87,7 +87,7 @@ void cTox_free(void *const ptr)
|
||||||
free(ptr);
|
free(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
VALUE cTox_initialize(const VALUE self, const VALUE options)
|
VALUE cTox_initialize_with(const VALUE self, const VALUE options)
|
||||||
{
|
{
|
||||||
cTox_ *tox;
|
cTox_ *tox;
|
||||||
cTox_cOptions_ *tox_options;
|
cTox_cOptions_ *tox_options;
|
||||||
|
|
|
@ -1 +1,7 @@
|
||||||
require 'tox/tox'
|
require 'tox/tox'
|
||||||
|
|
||||||
|
class Tox
|
||||||
|
def initialize(options = Tox::Options.new)
|
||||||
|
initialize_with(options)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
Reference in a new issue