Sha256: 864864b03560a921472913b4dfc6b9a43c73916ffd141c7563cc9935fc18d442
Contents?: true
Size: 534 Bytes
Versions: 2
Compression:
Stored size: 534 Bytes
Contents
# frozen_string_literal: true require 'gir_ffi/enum_like_base' module GirFFI # Base module for flags. module FlagsBase include EnumLikeBase def native_type self::BitMask.native_type end def to_native(value, context) case value when Symbol value = { value => true } end self::BitMask.to_native(value, context) end def from_native(*args) self::BitMask.from_native(*args).select { |_k, v| v } end def [](arg) self::BitMask[arg] end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
gir_ffi-0.11.1 | lib/gir_ffi/flags_base.rb |
gir_ffi-0.11.0 | lib/gir_ffi/flags_base.rb |