Class: Quilt::Performance::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/quilt_rails/performance/connection.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(downlink:, effective_type:, rtt:, type:) ⇒ Connection

Returns a new instance of Connection.



22
23
24
25
26
27
# File 'lib/quilt_rails/performance/connection.rb', line 22

def initialize(downlink:, effective_type:, rtt:, type:)
  @downlink = downlink
  @effective_type = effective_type
  @rtt = rtt
  @type = type
end

Instance Attribute Details

Returns the value of attribute downlink.



6
7
8
# File 'lib/quilt_rails/performance/connection.rb', line 6

def downlink
  @downlink
end

#effective_typeObject

Returns the value of attribute effective_type.



7
8
9
# File 'lib/quilt_rails/performance/connection.rb', line 7

def effective_type
  @effective_type
end

#rttObject

Returns the value of attribute rtt.



8
9
10
# File 'lib/quilt_rails/performance/connection.rb', line 8

def rtt
  @rtt
end

#typeObject

Returns the value of attribute type.



9
10
11
# File 'lib/quilt_rails/performance/connection.rb', line 9

def type
  @type
end

Class Method Details

.from_params(params) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/quilt_rails/performance/connection.rb', line 11

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

  Connection.new(
    downlink: params[:downlink],
    effective_type: params[:effective_type],
    rtt: params[:rtt],
    type: params[:type]
  )
end