Sha256: cf6915e6d12a5e7875e36e969b2011acb4e645d174dd5c9b56e1324ce0da1454

Contents?: true

Size: 805 Bytes

Versions: 15

Compression:

Stored size: 805 Bytes

Contents

# frozen_string_literal: true

module SimpleCov
  module Formatter
    class MultiFormatter
      module InstanceMethods
        def format(result)
          formatters.map do |formatter|
            formatter.new.format(result)
          rescue StandardError => e
            warn("Formatter #{formatter} failed with #{e.class}: #{e.message} (#{e.backtrace.first})")
            nil
          end
        end
      end

      def self.new(formatters = nil)
        Class.new do
          define_method :formatters do
            @formatters ||= Array(formatters)
          end
          include InstanceMethods
        end
      end

      def self.[](*args)
        warn "#{Kernel.caller.first}: [DEPRECATION] ::[] is deprecated. Use ::new instead."
        new(Array(args))
      end
    end
  end
end

Version data entries

15 entries across 14 versions & 8 rubygems

Version Path
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.1.0/gems/simplecov-0.22.0/lib/simplecov/formatter/multi_formatter.rb
trusty-cms-7.0.9.1 vendor/bundle/ruby/3.3.0/gems/simplecov-0.22.0/lib/simplecov/formatter/multi_formatter.rb
minato_ruby_api_client-0.2.2 vendor/bundle/ruby/3.2.0/gems/simplecov-0.22.0/lib/simplecov/formatter/multi_formatter.rb
strongmind-simplecov-0.23.0 lib/simplecov/formatter/multi_formatter.rb
blacklight-spotlight-3.6.0.beta8 vendor/bundle/ruby/3.2.0/gems/simplecov-0.22.0/lib/simplecov/formatter/multi_formatter.rb
simplecov-0.22.0 lib/simplecov/formatter/multi_formatter.rb
op_connect-0.1.2 vendor/bundle/ruby/3.1.0/gems/simplecov-0.21.2/lib/simplecov/formatter/multi_formatter.rb
rails_mini_profiler-0.2.0 vendor/bundle/ruby/3.0.0/gems/simplecov-0.21.2/lib/simplecov/formatter/multi_formatter.rb
simplecov-0.21.2 lib/simplecov/formatter/multi_formatter.rb
simplecov-0.21.1 lib/simplecov/formatter/multi_formatter.rb
simplecov-0.21.0 lib/simplecov/formatter/multi_formatter.rb
simplecov-0.20.0 lib/simplecov/formatter/multi_formatter.rb
simplecov-0.19.1 lib/simplecov/formatter/multi_formatter.rb
grape-extra_validators-2.0.0 vendor/bundle/ruby/2.6.0/gems/simplecov-0.19.0/lib/simplecov/formatter/multi_formatter.rb
simplecov-0.19.0 lib/simplecov/formatter/multi_formatter.rb