Sha256: 3078aa4795315feb916413718c21e7e13eed8abd14b44eee6195237a2b66c8be

Contents?: true

Size: 440 Bytes

Versions: 2

Compression:

Stored size: 440 Bytes

Contents

# frozen_string_literal: true

module GirFFI
  # Generates method stubs that will replace themselves with the real
  # method upon being called.
  class MethodStubber
    def initialize(method_info)
      @info = method_info
    end

    def method_stub
      <<~STUB
        def #{@info.method? ? "" : "self."}#{@info.safe_name} *args, &block
          setup_and_call "#{@info.name}", args, &block
        end
      STUB
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
gir_ffi-0.17.0 lib/gir_ffi/method_stubber.rb
gir_ffi-0.16.1 lib/gir_ffi/method_stubber.rb