Class: SpeedGun::Browser
- Inherits:
-
Object
- Object
- SpeedGun::Browser
- Defined in:
- lib/speed_gun/browser.rb
Defined Under Namespace
Classes: Navigation, Timing
Instance Attribute Summary collapse
-
#navigation ⇒ Object
readonly
Returns the value of attribute navigation.
-
#timing ⇒ Object
readonly
Returns the value of attribute timing.
-
#user_agent ⇒ Object
readonly
Returns the value of attribute user_agent.
Instance Method Summary collapse
- #as_msgpack(*args) ⇒ Object
-
#initialize(hash) ⇒ Browser
constructor
A new instance of Browser.
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
#navigation ⇒ Object (readonly)
Returns the value of attribute navigation.
10 11 12 |
# File 'lib/speed_gun/browser.rb', line 10 def @navigation end |
#timing ⇒ Object (readonly)
Returns the value of attribute timing.
10 11 12 |
# File 'lib/speed_gun/browser.rb', line 10 def timing @timing end |
#user_agent ⇒ Object (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 |