Module: FFI::NCurses::Compatibility

Extended by:
Compatibility
Included in:
Compatibility
Defined in:
lib/ffi-ncurses/ncurses.rb

Overview

Methods to help wrap FFI::NCurses methods to be compatible with Ncurses.

Instance Method Summary collapse

Instance Method Details

#lookup_signature(method) ⇒ Object



17
18
19
# File 'lib/ffi-ncurses/ncurses.rb', line 17

def lookup_signature(method)
  FFI::NCurses::FUNCTION_SIGNATURES.assoc(method)
end

#unbox_args(signature, args) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/ffi-ncurses/ncurses.rb', line 21

def unbox_args(signature, args)
  if signature
  signature[1].zip(args).map{ |sig, arg|
    case sig
    when :window_p
      #log :unbox_args, signature, arg, arg.respond_to?(:win)
      if arg.respond_to?(:win)
        #log :unbox_args, :win, arg.win
        arg.win
      else
        #log :unbox_args, :nowin, arg
        arg
      end
    when :chtype
      arg.ord
    else
      arg
    end
  }
  else
    args
  end
end