Class: GirFFI::MethodStubber
- Inherits:
-
Object
- Object
- GirFFI::MethodStubber
- Defined in:
- lib/gir_ffi/method_stubber.rb
Overview
Generates method stubs that will replace themselves with the real method upon being called.
Instance Method Summary collapse
-
#initialize(method_info) ⇒ MethodStubber
constructor
A new instance of MethodStubber.
- #method_stub ⇒ Object
Constructor Details
#initialize(method_info) ⇒ MethodStubber
Returns a new instance of MethodStubber.
6 7 8 |
# File 'lib/gir_ffi/method_stubber.rb', line 6 def initialize(method_info) @info = method_info end |
Instance Method Details
#method_stub ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/gir_ffi/method_stubber.rb', line 10 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 |