Sha256: 1b3d52d6b307a0ac3863425fada696247879cf7af2e4f26304495f063136d133

Contents?: true

Size: 515 Bytes

Versions: 2

Compression:

Stored size: 515 Bytes

Contents

class Bogus::RecordingProxy < BasicObject
  extend ::Bogus::Takes
  takes :instance, :fake_name, :interactions_repository

  def method_missing(name, *args, &block)
    returned_value = @instance.__send__(name, *args, &block)
    @interactions_repository.record(@fake_name, name, *args) { returned_value }
    returned_value
  rescue => e
    @interactions_repository.record(@fake_name, name, *args) { ::Kernel.raise(e) }
    ::Kernel.raise
  end

  def respond_to?(name)
    @instance.respond_to?(name)
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
bogus-0.0.2 lib/bogus/recording_proxy.rb
bogus-0.0.1 lib/bogus/recording_proxy.rb