File: g_type.rb

package info (click to toggle)
ruby-gir-ffi 0.11.0-1
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 1,812 kB
  • ctags: 1,637
  • sloc: ruby: 20,737; makefile: 90; sh: 1
file content (28 lines) | stat: -rw-r--r-- 474 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# frozen_string_literal: true
module GirFFI
  # Wrapper class providing extended functionality for a GType, which is
  # normally just a kind of integer
  class GType
    def initialize(gtype)
      @gtype = gtype
    end

    def to_i
      @gtype
    end

    def class_size
      type_query.class_size
    end

    def instance_size
      type_query.instance_size
    end

    private

    def type_query
      @type_query ||= GObject.type_query @gtype
    end
  end
end