Module: GirFFI::EnumBase

Defined in:
lib/gir_ffi/enum_base.rb

Instance Method Summary collapse

Instance Method Details

#[](arg) ⇒ Object



3
4
5
# File 'lib/gir_ffi/enum_base.rb', line 3

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

#gir_ffi_builderObject



21
22
23
# File 'lib/gir_ffi/enum_base.rb', line 21

def gir_ffi_builder
  self.const_get :GIR_FFI_BUILDER
end

#setup_and_call(method, *arguments, &block) ⇒ Object



11
12
13
14
15
16
17
18
19
# File 'lib/gir_ffi/enum_base.rb', line 11

def setup_and_call method, *arguments, &block
  result = setup_method method.to_s

  unless result
    raise RuntimeError, "Unable to set up method #{method} in #{self}"
  end

  self.send method, *arguments, &block
end

#setup_method(name) ⇒ Object



29
30
31
# File 'lib/gir_ffi/enum_base.rb', line 29

def setup_method name
  gir_ffi_builder.setup_method name
end

#to_ffitypeObject



25
26
27
# File 'lib/gir_ffi/enum_base.rb', line 25

def to_ffitype
  self::Enum
end

#to_native(*args) ⇒ Object



7
8
9
# File 'lib/gir_ffi/enum_base.rb', line 7

def to_native *args
  self::Enum.to_native(*args)
end