Class: MetOnTheMiddle::Readers::ViewTime
- Defined in:
- lib/met_on_the_middle/readers/view_time.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize ⇒ ViewTime
constructor
A new instance of ViewTime.
- #match_subscription ⇒ Object
- #parse(e, request: nil) ⇒ Object
Methods inherited from Base
#register_subscription, #to_key_value
Constructor Details
#initialize ⇒ ViewTime
Returns a new instance of ViewTime.
4 5 6 |
# File 'lib/met_on_the_middle/readers/view_time.rb', line 4 def initialize super :view_time end |
Instance Method Details
#match_subscription ⇒ Object
8 9 10 |
# File 'lib/met_on_the_middle/readers/view_time.rb', line 8 def match_subscription /render_(partial|template).action_view/ end |
#parse(e, request: nil) ⇒ Object
12 13 14 15 16 17 18 19 |
# File 'lib/met_on_the_middle/readers/view_time.rb', line 12 def parse(e, request: nil) path = e.payload[:identifier].split('/views/', 2) duration = 0 duration = e.duration if path[1] (duration+(request.get(key)||0)).round(2) end |