Sha256: b2b938049f8b1256403121a0e4187ec22ecd760eb2aee3240b057f018d14ae75

Contents?: true

Size: 626 Bytes

Versions: 12

Compression:

Stored size: 626 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

  # apparently even BasicObject has an equality operator
  def ==(other)
    method_missing(:==, other)
  end

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

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
bogus-0.1.7 lib/bogus/contracts/recording_proxy.rb
bogus-0.1.6 lib/bogus/contracts/recording_proxy.rb
bogus-0.1.5 lib/bogus/contracts/recording_proxy.rb
bogus-0.1.4 lib/bogus/contracts/recording_proxy.rb
bogus-0.1.3 lib/bogus/recording_proxy.rb
bogus-0.1.2 lib/bogus/recording_proxy.rb
bogus-0.1.1 lib/bogus/recording_proxy.rb
bogus-0.1.0 lib/bogus/recording_proxy.rb
bogus-0.0.4 lib/bogus/recording_proxy.rb
bogus-0.0.3 lib/bogus/recording_proxy.rb
bogus-0.0.3.rc.2 lib/bogus/recording_proxy.rb
bogus-0.0.3.rc.1 lib/bogus/recording_proxy.rb