ruby: Add Guestfs::Guestfs.new() method.
authorRichard Jones <rjones@redhat.com>
Thu, 2 Sep 2010 11:01:06 +0000 (12:01 +0100)
committerRichard Jones <rjones@redhat.com>
Thu, 2 Sep 2010 11:03:54 +0000 (12:03 +0100)
This is a more standard way to create objects in Ruby.  The old
way was to call the module function Guestfs::create() which still
works.

src/generator.ml

index 97dc6ac..3f5fd6c 100755 (executable)
@@ -10835,6 +10835,10 @@ void Init__guestfs ()
   c_guestfs = rb_define_class_under (m_guestfs, \"Guestfs\", rb_cObject);
   e_Error = rb_define_class_under (m_guestfs, \"Error\", rb_eStandardError);
 
   c_guestfs = rb_define_class_under (m_guestfs, \"Guestfs\", rb_cObject);
   e_Error = rb_define_class_under (m_guestfs, \"Error\", rb_eStandardError);
 
+#ifdef HAVE_RB_DEFINE_ALLOC_FUNC
+  rb_define_alloc_func (c_guestfs, ruby_guestfs_create);
+#endif
+
   rb_define_module_function (m_guestfs, \"create\", ruby_guestfs_create, 0);
   rb_define_method (c_guestfs, \"close\", ruby_guestfs_close, 0);
 
   rb_define_module_function (m_guestfs, \"create\", ruby_guestfs_create, 0);
   rb_define_method (c_guestfs, \"close\", ruby_guestfs_close, 0);