Module: Ncurses::MM

Included in:
Ncurses, Ncurses
Defined in:
lib/ffi-ncurses/ncurses.rb

Instance Method Summary collapse

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method, *args, &block) ⇒ Object



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
# File 'lib/ffi-ncurses/ncurses.rb', line 145

def method_missing(method, *args, &block)
  if FFI::NCurses.respond_to?(method)
    signature = FFI::NCurses::Compatibility.lookup_signature(method)
    args = FFI::NCurses::Compatibility.unbox_args(signature, args)
    res = FFI::NCurses.send(method, *args, &block)
    # log :MM, signature, res
    if signature && signature.last == :window_p && res.kind_of?(FFI::Pointer)
      Ncurses::WINDOW.new(res) { }
    else
      res
    end
  else
    super
  end
end

Instance Method Details

#respond_to?(method) ⇒ Boolean

Returns:

  • (Boolean)


161
162
163
# File 'lib/ffi-ncurses/ncurses.rb', line 161

def respond_to?(method)
  FFI::NCurses.respond_to?(method)
end