Class: SpeedGun::Browser

Inherits:
Object
  • Object
show all
Defined in:
lib/speed_gun/browser.rb

Defined Under Namespace

Classes: Navigation, Timing

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(hash) ⇒ Browser

Returns a new instance of Browser.



5
6
7
8
9
# File 'lib/speed_gun/browser.rb', line 5

def initialize(hash)
  @user_agent = UserAgent.parse(hash['user_agent'] || '')
  @navigation = Navigation.new(hash['navigation'] || {})
  @timing = Timing.new(hash['timing'] || {})
end

Instance Attribute Details

Returns the value of attribute navigation.



10
11
12
# File 'lib/speed_gun/browser.rb', line 10

def navigation
  @navigation
end

#timingObject (readonly)

Returns the value of attribute timing.



10
11
12
# File 'lib/speed_gun/browser.rb', line 10

def timing
  @timing
end

#user_agentObject (readonly)

Returns the value of attribute user_agent.



10
11
12
# File 'lib/speed_gun/browser.rb', line 10

def user_agent
  @user_agent
end

Instance Method Details

#as_msgpack(*args) ⇒ Object



12
13
14
15
16
17
18
# File 'lib/speed_gun/browser.rb', line 12

def as_msgpack(*args)
  {
    user_agent: @user_agent.to_s,
    navigation: @navigation,
    timing: @timing,
  }
end