Sha256: 841ddf8b4e373698a93287041381b52613c48369cda9248ca63829c9f9f4f048

Contents?: true

Size: 757 Bytes

Versions: 9

Compression:

Stored size: 757 Bytes

Contents

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

9 entries across 9 versions & 1 rubygems

Version Path
bidu-house-1.3.0 lib/bidu/house/status_builder.rb
bidu-house-1.2.0 lib/bidu/house/status_builder.rb
bidu-house-1.1.0 lib/bidu/house/status_builder.rb
bidu-house-1.0.0 lib/bidu/house/status_builder.rb
bidu-house-0.2.1 lib/bidu/house/status_builder.rb
bidu-house-0.2.0 lib/bidu/house/status_builder.rb
bidu-house-0.1.2 lib/bidu/house/status_builder.rb
bidu-house-0.1.1 lib/bidu/house/status_builder.rb
bidu-house-0.1.0 lib/bidu/house/status_builder.rb