Sha256: 43def30dc5f200a31943aebc7aa419a007261724616e14215585a659326be999

Contents?: true

Size: 757 Bytes

Versions: 2

Compression:

Stored size: 757 Bytes

Contents

module Bidu
  module Mercy
    class StatusBuilder
      def build(key, parameters = {})
        Bidu::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 ||= Bidu::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
end

Version data entries

2 entries across 2 versions & 2 rubygems

Version Path
mercy-1.3.0 lib/bidu/mercy/status_builder.rb
bidu-mercy-1.3.0 lib/bidu/mercy/status_builder.rb