Sha256: 0b8c9882c0351cb60f4781f9c47f1036f0ba63198df9007b4a774e2cf65f7130

Contents?: true

Size: 657 Bytes

Versions: 21

Compression:

Stored size: 657 Bytes

Contents

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)
        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
cucumber-2.99.0 lib/cucumber/formatter/fanout.rb
mobiusloop-0.1.5 lib/cucumber/formatter/fanout.rb
cucumber-2.4.0 lib/cucumber/formatter/fanout.rb
mobiusloop-0.1.3 lib/cucumber/formatter/fanout.rb
mobiusloop-0.1.2 lib/cucumber/formatter/fanout.rb
cucumber-2.3.3 lib/cucumber/formatter/fanout.rb
cucumber-2.3.2 lib/cucumber/formatter/fanout.rb
cucumber-2.3.1 lib/cucumber/formatter/fanout.rb
cucumber-2.3.0 lib/cucumber/formatter/fanout.rb
cucumber-2.2.0 lib/cucumber/formatter/fanout.rb
cucumber-2.1.0 lib/cucumber/formatter/fanout.rb
cucumber-2.0.2 lib/cucumber/formatter/fanout.rb
cucumber-2.0.1 lib/cucumber/formatter/fanout.rb
cucumber-2.0.0 lib/cucumber/formatter/fanout.rb
cucumber-2.0.0.rc.5 lib/cucumber/formatter/fanout.rb
cucumber-2.0.0.rc.4 lib/cucumber/formatter/fanout.rb
cucumber-2.0.0.rc.3 lib/cucumber/formatter/fanout.rb
cucumber-2.0.0.rc.2 lib/cucumber/formatter/fanout.rb
cucumber-2.0.0.rc.1 lib/cucumber/formatter/fanout.rb
cucumber-2.0.0.beta.5 lib/cucumber/formatter/fanout.rb