Class: MetOnTheMiddle::Readers::DatabaseTime

Inherits:
Base
  • Object
show all
Defined in:
lib/met_on_the_middle/readers/database_time.rb

Instance Attribute Summary

Attributes inherited from Base

#key

Instance Method Summary collapse

Methods inherited from Base

#register_subscription, #to_key_value

Constructor Details

#initializeDatabaseTime

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_subscriptionObject



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