Sha256: fb5cceb388ef5d4c2e9251b5a5ed2718437123dd5cacf6123df36778ff5e3cb7

Contents?: true

Size: 457 Bytes

Versions: 9

Compression:

Stored size: 457 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.reset_indentation
        def #{@info.method? ? '' : 'self.'}#{@info.safe_name} *args, &block
          setup_and_call "#{@info.name}", args, &block
        end
      STUB
    end
  end
end

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
gir_ffi-0.11.1 lib/gir_ffi/method_stubber.rb
gir_ffi-0.11.0 lib/gir_ffi/method_stubber.rb
gir_ffi-0.10.2 lib/gir_ffi/method_stubber.rb
gir_ffi-0.10.1 lib/gir_ffi/method_stubber.rb
gir_ffi-0.10.0 lib/gir_ffi/method_stubber.rb
gir_ffi-0.10.0.pre1 lib/gir_ffi/method_stubber.rb
gir_ffi-0.9.5 lib/gir_ffi/method_stubber.rb
gir_ffi-0.9.4 lib/gir_ffi/method_stubber.rb
gir_ffi-0.9.3 lib/gir_ffi/method_stubber.rb