class GirFFI::MethodStubber

Generates method stubs that will replace themselves with the real method upon being called.

Public Class Methods

new(method_info) click to toggle source
# File lib/gir_ffi/method_stubber.rb, line 5
def initialize method_info
  @info = method_info
end

Public Instance Methods

method_stub() click to toggle source
# File lib/gir_ffi/method_stubber.rb, line 9
def method_stub
  symbol = @info.name
  "
    def #{@info.method? ? '' : 'self.'}#{symbol} *args, &block
      setup_and_call :#{symbol}, *args, &block
    end
  "
end