Sha256: 4b7a64a8d0d8ea88007c93d70d72a49b7db54fba3b5874402dd783bea7e37bbf

Contents?: true

Size: 607 Bytes

Versions: 1

Compression:

Stored size: 607 Bytes

Contents

# frozen_string_literal: true

module Solid::Result::EventLogs
  class Config
    attr_reader :listener, :trace_id

    def initialize
      @trace_id = -> {}
      @listener = Listener::Null.new
    end

    def listener=(arg)
      Listener.kind?(arg) or raise ::ArgumentError, "#{arg.inspect} must be a #{Listener}"

      @listener = arg
    end

    def trace_id=(arg)
      raise ::ArgumentError, 'must be a lambda with arity 0' unless arg.is_a?(::Proc) && arg.lambda? && arg.arity.zero?

      @trace_id = arg
    end

    @instance = new

    singleton_class.send(:attr_reader, :instance)
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
solid-result-2.0.0 lib/solid/result/event_logs/config.rb