/** * call-seq: * MusicBrainz::DiscID.new(device=nil) -> obj * * Construct a new DiscID object. * * As an optional argument the name of the device to read the ID from * may be given. If you don't specify a device here you can later read * the ID with the read method. * * Raises:: ArgumentError, TypeError, Exception */ VALUE mb_discid_new(int argc, VALUE *argv, VALUE class) { DiscId *disc = discid_new(); VALUE tdata = Data_Wrap_Struct(class, 0, discid_free, disc); VALUE device = Qnil; rb_obj_call_init(tdata, 0, 0); rb_iv_set(tdata, "@read", Qfalse); /* Check the number of arguments */ rb_scan_args(argc, argv, "01", &device); if (device != Qnil) rb_funcall(tdata, rb_intern("read"), 1, device); return tdata; }