class GObjectIntrospection::IConstantInfo

Wraps a GIConstantInfo struct; represents a constant.

Constants

TYPE_TAG_TO_UNION_MEMBER

Public Instance Methods

constant_type() click to toggle source
# File lib/ffi-gobject_introspection/i_constant_info.rb, line 29
def constant_type
  ITypeInfo.wrap(Lib.g_constant_info_get_type @gobj)
end
value() click to toggle source
# File lib/ffi-gobject_introspection/i_constant_info.rb, line 18
def value
  case type_tag
  when :utf8
    raw_value.force_encoding('utf-8')
  when :gboolean
    raw_value != 0
  else
    raw_value
  end
end

Private Instance Methods

raw_value() click to toggle source
# File lib/ffi-gobject_introspection/i_constant_info.rb, line 39
def raw_value
  value_union = Lib::GIArgument.new
  Lib.g_constant_info_get_value @gobj, value_union
  value_union[union_member_key]
end
type_tag() click to toggle source
# File lib/ffi-gobject_introspection/i_constant_info.rb, line 35
def type_tag
  @type_tag ||= constant_type.tag
end
union_member_key() click to toggle source
# File lib/ffi-gobject_introspection/i_constant_info.rb, line 45
def union_member_key
  TYPE_TAG_TO_UNION_MEMBER[type_tag]
end