Sha256: 70e467c7370b50542ccd99c3e5d455011a46bdec9274b729f19a5a73b9ca1915

Contents?: true

Size: 675 Bytes

Versions: 2

Compression:

Stored size: 675 Bytes

Contents

module Mercy
  class StatusBuilder
    def build(key, parameters = {})
      Mercy::Status.new(reports_for(key, parameters))
    end

    def add_report_config(key, config)
      status_key = config.delete(:on) || :default
      report_builder.add_config(key, config)
      config_for(status_key) << key
    end

    private

    def report_builder
      @report_builder ||= Mercy::ReportBuilder.new
    end

    def reports_for(key, parameters)
      config_for(key).map do |report_key|
        report_builder.build(report_key, parameters)
      end
    end

    def configs
      @configs ||= {}
    end

    def config_for(key)
      configs[key] ||= []
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
mercy-1.6.0 lib/mercy/status_builder.rb
mercy-1.5.0 lib/mercy/status_builder.rb