Class: GObjectIntrospection::IConstantInfo

Inherits:
IBaseInfo
  • Object
show all
Defined in:
lib/ffi-gobject_introspection/i_constant_info.rb

Overview

Wraps a GIConstantInfo struct; represents a constant.

Constant Summary collapse

TYPE_TAG_TO_UNION_MEMBER =
{
  gboolean: :v_boolean,
  gint8:    :v_int8,
  gint16:   :v_int16,
  gint32:   :v_int32,
  gint64:   :v_int64,
  guint8:   :v_uint8,
  guint16:  :v_uint16,
  guint32:  :v_uint32,
  guint64:  :v_uint64,
  gdouble:  :v_double,
  utf8:     :v_string
}.freeze

Instance Attribute Summary

Attributes inherited from IBaseInfo

#pointer

Instance Method Summary collapse

Methods inherited from IBaseInfo

#==, #attribute, build_array_method, build_finder_method, #container, #deprecated?, #info_type, #initialize, make_finalizer, #name, #namespace, #safe_namespace, #to_ptr, wrap

Constructor Details

This class inherits a constructor from GObjectIntrospection::IBaseInfo

Instance Method Details

#constant_typeObject



31
32
33
# File 'lib/ffi-gobject_introspection/i_constant_info.rb', line 31

def constant_type
  ITypeInfo.wrap Lib.g_constant_info_get_type self
end

#valueObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/ffi-gobject_introspection/i_constant_info.rb', line 20

def value
  case type_tag
  when :utf8
    raw_value.force_encoding('utf-8')
  when :gboolean
    raw_value.nonzero? ? true : false
  else
    raw_value
  end
end