def set value
      # GLib::logger.debug("GObject::GValue.set") {
      #     "value = #{value.inspect[0..50]}"
      # }

      gtype = self[:gtype]
      fundamental = ::GObject::g_type_fundamental gtype

      case gtype
      when GBOOL_TYPE
        ::GObject::g_value_set_boolean self, (value ? 1 : 0)

      when GINT_TYPE
        ::GObject::g_value_set_int self, value

      when GUINT64_TYPE
        ::GObject::g_value_set_uint64 self, value

      when GDOUBLE_TYPE
        ::GObject::g_value_set_double self, value

      when GSTR_TYPE
        ::GObject::g_value_set_string self, value

      when Vips::REFSTR_TYPE
        ::Vips::vips_value_set_ref_string self, value

      when Vips::ARRAY_INT_TYPE
        value = [value] unless value.is_a? Array

        Vips::vips_value_set_array_int self, nil, value.length
        ptr = Vips::vips_value_get_array_int self, nil
        ptr.write_array_of_int32 value

      when Vips::ARRAY_DOUBLE_TYPE
        value = [value] unless value.is_a? Array

        # this will allocate an array in the gvalue
        Vips::vips_value_set_array_double self, nil, value.length

        # pull the array out and fill it
        ptr = Vips::vips_value_get_array_double self, nil

        ptr.write_array_of_double value

      when Vips::ARRAY_IMAGE_TYPE
        value = [value] unless value.is_a? Array

        Vips::vips_value_set_array_image self, value.length
        ptr = Vips::vips_value_get_array_image self, nil
        ptr.write_array_of_pointer value

        # the gvalue needs a ref on each of the images
        value.each {|image| ::GObject::g_object_ref image}

      when Vips::BLOB_TYPE
        len = value.bytesize
        ptr = GLib::g_malloc len
        Vips::vips_value_set_blob self, GLib::G_FREE, ptr, len
        ptr.write_bytes value

      else
        case fundamental
        when GFLAGS_TYPE
          ::GObject::g_value_set_flags self, value

        when GENUM_TYPE
          enum_value = GValue.from_nick(self[:gtype], value)
          ::GObject::g_value_set_enum self, enum_value

        when GOBJECT_TYPE
          ::GObject::g_value_set_object self, value

        else
          raise Vips::Error, "unimplemented gtype for set: " +
              "#{::GObject::g_type_name gtype} (#{gtype})"

        end
      end
    end
def set value
      # GLib::logger.debug("GObject::GValue.set") {
      #     "value = #{value.inspect[0..50]}"
      # }

      gtype = self[:gtype]
      fundamental = ::GObject::g_type_fundamental gtype

      case gtype
      when GBOOL_TYPE
        ::GObject::g_value_set_boolean self, (value ? 1 : 0)

      when GINT_TYPE
        ::GObject::g_value_set_int self, value

      when GUINT64_TYPE
        ::GObject::g_value_set_uint64 self, value

      when GDOUBLE_TYPE
        ::GObject::g_value_set_double self, value

      when GSTR_TYPE
        ::GObject::g_value_set_string self, value

      when Vips::REFSTR_TYPE
        ::Vips::vips_value_set_ref_string self, value

      when Vips::ARRAY_INT_TYPE
        value = [value] unless value.is_a? Array

        Vips::vips_value_set_array_int self, nil, value.length
        ptr = Vips::vips_value_get_array_int self, nil
        ptr.write_array_of_int32 value

      when Vips::ARRAY_DOUBLE_TYPE
        value = [value] unless value.is_a? Array

        # this will allocate an array in the gvalue
        Vips::vips_value_set_array_double self, nil, value.length

        # pull the array out and fill it
        ptr = Vips::vips_value_get_array_double self, nil

        ptr.write_array_of_double value

      when Vips::ARRAY_IMAGE_TYPE
        value = [value] unless value.is_a? Array

        Vips::vips_value_set_array_image self, value.length
        ptr = Vips::vips_value_get_array_image self, nil
        ptr.write_array_of_pointer value

        # the gvalue needs a ref on each of the images
        value.each {|image| ::GObject::g_object_ref image}

      when Vips::BLOB_TYPE
        len = value.bytesize
        ptr = GLib::g_malloc len
        Vips::vips_value_set_blob self, GLib::G_FREE, ptr, len
        ptr.write_bytes value

      else
        case fundamental
        when GFLAGS_TYPE
          ::GObject::g_value_set_flags self, value

        when GENUM_TYPE
          enum_value = GValue.from_nick(self[:gtype], value)
          ::GObject::g_value_set_enum self, enum_value

        when GOBJECT_TYPE
          ::GObject::g_value_set_object self, value

        else
          raise Vips::Error, "unimplemented gtype for set: " +
              "#{::GObject::g_type_name gtype} (#{gtype})"

        end
      end
    end
Set the value of a GValue. The value is converted to the type of the
 GValue, if possible.

 @param value [Any] The value to set