class Popro::Formatter::Aggregate

Public Class Methods

new(*formatters, &block) click to toggle source
# File lib/popro/formatter.rb, line 6
def initialize(*formatters, &block)
  @formatters = formatters
  @join = if block_given?
            block
          else
            proc(&:join)
          end
end

Public Instance Methods

call(info, *args) click to toggle source
# File lib/popro/formatter.rb, line 15
def call(info, *args)
  @join.call(
    @formatters.collect do |formatter|
      formatter.call(info, *args)
    end
  )
end