Sha256: b3fe6aa4651e754748286553ebfea46e15d74cd8c977a3e78d7af4fb751d9d1b
Contents?: true
Size: 749 Bytes
Versions: 9
Compression:
Stored size: 749 Bytes
Contents
# frozen_string_literal: true require 'gir_ffi/builders/enum_builder' require 'gir_ffi/flags_base' module GirFFI module Builders # Implements the creation of a flags type. The type will be # attached to the appropriate namespace module, and will be defined # as a bit_mask for FFI. class FlagsBuilder < EnumBuilder def setup_ffi_type optionally_define_constant klass, :BitMask do lib.bit_mask(enum_sym, value_spec) end end def value_spec info.values.map do |vinfo| val = GirFFI::ArgHelper.cast_uint32_to_int32(vinfo.value) { vinfo.name.to_sym => val } end.reduce(:merge) end def superclass FlagsBase end end end end
Version data entries
9 entries across 9 versions & 1 rubygems