From: Antonio Terceiro <terceiro@debian.org>
Date: Tue, 15 Apr 2014 19:43:24 -0300
Subject: Port to Ruby 2.1 and 3.x
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"
Content-Transfer-Encoding: 8bit

Fix error:
GD.c:1725:25: error: assignment of read-only member ‘klass’

Forwarded: not-possible
Last-Update: 2021-10-31
---
 GD.c | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/GD.c b/GD.c
index d019b21..bfdc867 100644
--- a/GD.c
+++ b/GD.c
@@ -1711,13 +1711,20 @@ img_wbmp(img, fg, out)
  *
  */
 
+#include <ruby/version.h>
+
 static VALUE
 ply_new(klass)
     VALUE klass;
 {
     VALUE self = rb_ary_new();
 
+    #if (RUBY_API_VERSION_MAJOR >= 3) || ((RUBY_API_VERSION_MAJOR >= 2) && (RUBY_API_VERSION_MINOR >= 1))
+    rb_obj_reveal(self, klass);
+    #else
     RBASIC(self)->klass = klass;
+    #endif
+
     return self;
 }
 
