Class: MetOnTheMiddle::Readers::DatabaseTime
- Defined in:
- lib/met_on_the_middle/readers/database_time.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#initialize ⇒ DatabaseTime
constructor
A new instance of DatabaseTime.
- #match_subscription ⇒ Object
- #parse(e, request: nil) ⇒ Object
Methods inherited from Base
#register_subscription, #to_key_value
Constructor Details
#initialize ⇒ DatabaseTime
Returns a new instance of DatabaseTime.
4 5 6 |
# File 'lib/met_on_the_middle/readers/database_time.rb', line 4 def initialize super :database_time end |
Instance Method Details
#match_subscription ⇒ Object
8 9 10 |
# File 'lib/met_on_the_middle/readers/database_time.rb', line 8 def match_subscription 'sql.active_record' end |
#parse(e, request: nil) ⇒ Object
12 13 14 15 |
# File 'lib/met_on_the_middle/readers/database_time.rb', line 12 def parse(e, request: nil) return e.duration if request.nil? (e.duration+(request.get(key)||0)).round(2) end |