summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorRichard Jones <rjones@redhat.com>2010-09-02 12:01:06 +0100
committerRichard Jones <rjones@redhat.com>2010-09-02 12:03:54 +0100
commit25521f17d5b0841a13d66fc515fac0cffe23d9a1 (patch)
tree4026a0f0b0147afd7af747424372a6787fc4e4e3 /src
parentb8b0c99b46172712aa190f70182734934587af7b (diff)
downloadlibguestfs-25521f17d5b0841a13d66fc515fac0cffe23d9a1.tar.gz
libguestfs-25521f17d5b0841a13d66fc515fac0cffe23d9a1.tar.xz
libguestfs-25521f17d5b0841a13d66fc515fac0cffe23d9a1.zip
ruby: Add Guestfs::Guestfs.new() method.
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.
Diffstat (limited to 'src')
-rwxr-xr-xsrc/generator.ml4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/generator.ml b/src/generator.ml
index 97dc6ac4..3f5fd6c4 100755
--- a/src/generator.ml
+++ b/src/generator.ml
@@ -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);
+#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);