Sha256: 7b442dc10927877266147fd09d5105056cc35188c7b0290321363a63437a7526

Contents?: true

Size: 458 Bytes

Versions: 9

Compression:

Stored size: 458 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.14.1 lib/gir_ffi/method_stubber.rb
gir_ffi-0.14.0 lib/gir_ffi/method_stubber.rb
gir_ffi-0.13.1 lib/gir_ffi/method_stubber.rb
gir_ffi-0.13.0 lib/gir_ffi/method_stubber.rb
gir_ffi-0.12.1 lib/gir_ffi/method_stubber.rb
gir_ffi-0.12.0 lib/gir_ffi/method_stubber.rb
gir_ffi-0.11.4 lib/gir_ffi/method_stubber.rb
gir_ffi-0.11.3 lib/gir_ffi/method_stubber.rb
gir_ffi-0.11.2 lib/gir_ffi/method_stubber.rb