Module: GirFFI::FlagsBase

Includes:
EnumLikeBase
Defined in:
lib/gir_ffi/flags_base.rb

Overview

Base module for flags.

Instance Method Summary collapse

Methods included from EnumLikeBase

#copy_value_to_pointer, #get_value_from_pointer, #setup_and_call, #size, #to_callback_ffi_type, #to_ffi_type, #to_int, #wrap

Methods included from MethodSetup

#setup_method, #setup_method!

Methods included from RegisteredTypeBase

#gtype

Methods included from TypeBase

#gir_ffi_builder, #gir_info

Instance Method Details

#[](arg) ⇒ Object



26
27
28
# File 'lib/gir_ffi/flags_base.rb', line 26

def [](arg)
  self::BitMask[arg]
end

#from_native(*args) ⇒ Object



22
23
24
# File 'lib/gir_ffi/flags_base.rb', line 22

def from_native(*args)
  self::BitMask.from_native(*args).select { |_k, v| v }
end

#native_typeObject



10
11
12
# File 'lib/gir_ffi/flags_base.rb', line 10

def native_type
  self::BitMask.native_type
end

#to_native(value, context) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/gir_ffi/flags_base.rb', line 14

def to_native(value, context)
  case value
  when Symbol
    value = { value => true }
  end
  self::BitMask.to_native(value, context)
end