Sha256: daa8c95f60b5bfaaffa3faf037eb88ba526d8c1ed7831bb63c3e639442225ee6

Contents?: true

Size: 718 Bytes

Versions: 21

Compression:

Stored size: 718 Bytes

Contents

# frozen_string_literal: true

module Cucumber
  module Formatter
    # Forwards any messages sent to this object to all recipients
    # that respond to that message.
    class Fanout < BasicObject
      attr_reader :recipients
      private :recipients

      def initialize(recipients)
        @recipients = recipients
      end

      def method_missing(message, *args)
        super unless recipients

        recipients.each do |recipient|
          recipient.send(message, *args) if recipient.respond_to?(message)
        end
      end

      def respond_to_missing?(name, include_private = false)
        recipients.any? { |recipient| recipient.respond_to?(name, include_private) }
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 2 rubygems

Version Path
phillipug-foodie-0.1.0 .vendor/ruby/3.0.0/gems/cucumber-7.1.0/lib/cucumber/formatter/fanout.rb
cucumber-7.1.0 lib/cucumber/formatter/fanout.rb
cucumber-7.0.0 lib/cucumber/formatter/fanout.rb
cucumber-6.1.0 lib/cucumber/formatter/fanout.rb
cucumber-6.0.0 lib/cucumber/formatter/fanout.rb
cucumber-5.3.0 lib/cucumber/formatter/fanout.rb
cucumber-5.2.0 lib/cucumber/formatter/fanout.rb
cucumber-5.1.3 lib/cucumber/formatter/fanout.rb
cucumber-5.1.2 lib/cucumber/formatter/fanout.rb
cucumber-5.1.1 lib/cucumber/formatter/fanout.rb
cucumber-5.1.0 lib/cucumber/formatter/fanout.rb
cucumber-5.0.0 lib/cucumber/formatter/fanout.rb
cucumber-4.1.0 lib/cucumber/formatter/fanout.rb
cucumber-4.0.1 lib/cucumber/formatter/fanout.rb
cucumber-4.0.0 lib/cucumber/formatter/fanout.rb
cucumber-4.0.0.rc.6 lib/cucumber/formatter/fanout.rb
cucumber-4.0.0.rc.5 lib/cucumber/formatter/fanout.rb
cucumber-4.0.0.rc.4 lib/cucumber/formatter/fanout.rb
cucumber-4.0.0.rc.3 lib/cucumber/formatter/fanout.rb
cucumber-4.0.0.rc.2 lib/cucumber/formatter/fanout.rb