Sha256: ac98fed1582becead2645edba0f2172bef90852c793a940be4a9fc45b4a7a4b0

Contents?: true

Size: 1 KB

Versions: 6

Compression:

Stored size: 1 KB

Contents

# frozen_string_literal: true

module Quilt
  module Performance
    class Report
      attr_accessor :events
      attr_accessor :navigations
      attr_accessor :connection

      def self.from_params(params)
        params.transform_keys! { |key| key.underscore.to_sym }
        params.require(:connection)

        connection = Connection.from_params(params[:connection])

        Report.new(
          connection: connection,
          navigations: (params[:navigations] || []).map do |navigation|
            navigation = Navigation.from_params(navigation)
            navigation.connection = connection
            navigation
          end,
          events: (params[:events] || []).map do |event|
            event = Event.from_params(event)
            event.connection = connection
            event
          end,
        )
      end

      def initialize(events:, navigations:, connection:)
        @events = events
        @navigations = navigations
        @connection = connection
      end
    end
  end
end

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
quilt_rails-1.12.0 lib/quilt_rails/performance/report.rb
quilt_rails-1.11.1 lib/quilt_rails/performance/report.rb
quilt_rails-1.10.0 lib/quilt_rails/performance/report.rb
quilt_rails-1.9.2 lib/quilt_rails/performance/report.rb
quilt_rails-1.9.1 lib/quilt_rails/performance/report.rb
quilt_rails-1.9.0 lib/quilt_rails/performance/report.rb