Sha256: 96c5442d67f5799176c65b0eb68ecc3cf6974dd2b8502e41803c4ba25ebda2d4

Contents?: true

Size: 440 Bytes

Versions: 11

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

11 entries across 11 versions & 1 rubygems

Version Path
gir_ffi-0.16.0 lib/gir_ffi/method_stubber.rb
gir_ffi-0.15.9 lib/gir_ffi/method_stubber.rb
gir_ffi-0.15.8 lib/gir_ffi/method_stubber.rb
gir_ffi-0.15.7 lib/gir_ffi/method_stubber.rb
gir_ffi-0.15.6 lib/gir_ffi/method_stubber.rb
gir_ffi-0.15.5 lib/gir_ffi/method_stubber.rb
gir_ffi-0.15.4 lib/gir_ffi/method_stubber.rb
gir_ffi-0.15.3 lib/gir_ffi/method_stubber.rb
gir_ffi-0.15.2 lib/gir_ffi/method_stubber.rb
gir_ffi-0.15.1 lib/gir_ffi/method_stubber.rb
gir_ffi-0.15.0 lib/gir_ffi/method_stubber.rb