Sha256: 7d0c65054e94fb07f9929b8db2abdfbb45e9ec37cd3c99178690be5826556783

Contents?: true

Size: 606 Bytes

Versions: 2

Compression:

Stored size: 606 Bytes

Contents

# frozen_string_literal: true

module BCDD::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

2 entries across 2 versions & 1 rubygems

Version Path
bcdd-result-1.1.0 lib/bcdd/result/event_logs/config.rb
bcdd-result-1.0.0 lib/bcdd/result/event_logs/config.rb