Sha256: cc791e0214feeb2457a2bed02bf08469b5839b1c3fec33dcfb6655c47f8fecc0

Contents?: true

Size: 874 Bytes

Versions: 10

Compression:

Stored size: 874 Bytes

Contents

# frozen_string_literal: true

GLib.load_class :Variant

module GLib
  # Overrides for GVariant, GLib's variant data type.
  class Variant
    setup_instance_method! "get_string"

    def get_string_with_override
      get_string_without_override.first
    end

    alias get_string_without_override get_string
    alias get_string get_string_with_override

    # Initializing method used in constructors. For Variant, this needs to sink
    # the variant's floating reference.
    #
    # NOTE: This is very hard to test since it is not possible to get the
    # variant's ref count directely. However, there is an error when running
    # the tests on 32-bit systems.
    #
    def store_pointer(ptr)
      Lib.g_variant_ref_sink ptr
      super
    end

    # For variants, wrap_copy does not do any copying.
    def self.wrap_copy(val)
      wrap(val)
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
gir_ffi-0.15.9 lib/ffi-glib/variant.rb
gir_ffi-0.15.8 lib/ffi-glib/variant.rb
gir_ffi-0.15.7 lib/ffi-glib/variant.rb
gir_ffi-0.15.6 lib/ffi-glib/variant.rb
gir_ffi-0.15.5 lib/ffi-glib/variant.rb
gir_ffi-0.15.4 lib/ffi-glib/variant.rb
gir_ffi-0.15.3 lib/ffi-glib/variant.rb
gir_ffi-0.15.2 lib/ffi-glib/variant.rb
gir_ffi-0.15.1 lib/ffi-glib/variant.rb
gir_ffi-0.15.0 lib/ffi-glib/variant.rb