Sha256: bbee4160cd1a68a5ccb5b54a7dc7e560306015c7f8bdce5bd3bfd2843ca640e6
Contents?: true
Size: 892 Bytes
Versions: 5
Compression:
Stored size: 892 Bytes
Contents
require 'gir_ffi/builder/type/registered_type' module GirFFI module Builder module Type # Implements the creation of an enum or flags type. The type will be # attached to the appropriate namespace module, and will be defined # as an enum for FFI. class Enum < RegisteredType private def value_spec return info.values.map {|vinfo| val = GirFFI::ArgHelper.cast_uint32_to_int32(vinfo.value) [vinfo.name.to_sym, val] }.flatten end def instantiate_class if const_defined_for namespace_module, @classname @klass = namespace_module.const_get @classname else @klass = namespace_module.const_set @classname, lib.enum(@classname.to_sym, value_spec) setup_gtype_getter end end end end end end
Version data entries
5 entries across 5 versions & 1 rubygems