Sha256: 140e1d547183222d49779954ab62f6da29980952099aa6505ba7dc47f096b149

Contents?: true

Size: 440 Bytes

Versions: 6

Compression:

Stored size: 440 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.to_sym.inspect}, *args, &block
        end
      STUB
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
gir_ffi-0.7.6 lib/gir_ffi/method_stubber.rb
gir_ffi-0.7.5 lib/gir_ffi/method_stubber.rb
gir_ffi-0.7.4 lib/gir_ffi/method_stubber.rb
gir_ffi-0.7.3 lib/gir_ffi/method_stubber.rb
gir_ffi-0.7.2 lib/gir_ffi/method_stubber.rb
gir_ffi-0.7.1 lib/gir_ffi/method_stubber.rb