Class: Quilt::Performance::Report
- Inherits:
-
Object
- Object
- Quilt::Performance::Report
- Defined in:
- lib/quilt_rails/performance/report.rb
Instance Attribute Summary collapse
-
#connection ⇒ Object
Returns the value of attribute connection.
-
#events ⇒ Object
Returns the value of attribute events.
-
#navigations ⇒ Object
Returns the value of attribute navigations.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(events:, navigations:, connection:) ⇒ Report
constructor
A new instance of Report.
Constructor Details
#initialize(events:, navigations:, connection:) ⇒ Report
Returns a new instance of Report.
31 32 33 34 35 |
# File 'lib/quilt_rails/performance/report.rb', line 31 def initialize(events:, navigations:, connection:) @events = events @navigations = @connection = connection end |
Instance Attribute Details
#connection ⇒ Object
Returns the value of attribute connection.
8 9 10 |
# File 'lib/quilt_rails/performance/report.rb', line 8 def connection @connection end |
#events ⇒ Object
Returns the value of attribute events.
6 7 8 |
# File 'lib/quilt_rails/performance/report.rb', line 6 def events @events end |
#navigations ⇒ Object
Returns the value of attribute navigations.
7 8 9 |
# File 'lib/quilt_rails/performance/report.rb', line 7 def @navigations end |
Class Method Details
.from_params(params) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/quilt_rails/performance/report.rb', line 10 def self.from_params(params) params.transform_keys! { |key| key.underscore.to_sym } params[:connection] = { effectiveType: 'unknown' } if params[:connection].blank? connection = Connection.from_params(params[:connection]) Report.new( connection: connection, navigations: (params[:navigations] || []).map do || = Navigation.from_params() .connection = connection end, events: (params[:events] || []).map do |event| event = Event.from_params(event) event.connection = connection event end, ) end |