Sha256: 6cb0b5f3eae48a06573f6b0ba2efbac48fc401668c6f2500fe8f2e4ee0eb936d

Contents?: true

Size: 427 Bytes

Versions: 10

Compression:

Stored size: 427 Bytes

Contents

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

10 entries across 10 versions & 1 rubygems

Version Path
gir_ffi-0.9.2 lib/gir_ffi/method_stubber.rb
gir_ffi-0.9.1 lib/gir_ffi/method_stubber.rb
gir_ffi-0.9.0 lib/gir_ffi/method_stubber.rb
gir_ffi-0.8.6 lib/gir_ffi/method_stubber.rb
gir_ffi-0.8.5 lib/gir_ffi/method_stubber.rb
gir_ffi-0.8.4 lib/gir_ffi/method_stubber.rb
gir_ffi-0.8.3 lib/gir_ffi/method_stubber.rb
gir_ffi-0.8.2 lib/gir_ffi/method_stubber.rb
gir_ffi-0.8.1 lib/gir_ffi/method_stubber.rb
gir_ffi-0.8.0 lib/gir_ffi/method_stubber.rb