Class: ScoutApm::Remote::Router
- Inherits:
-
Object
- Object
- ScoutApm::Remote::Router
- Defined in:
- lib/scout_apm/remote/router.rb
Instance Attribute Summary collapse
-
#logger ⇒ Object
readonly
Returns the value of attribute logger.
-
#routes ⇒ Object
readonly
Returns the value of attribute routes.
Instance Method Summary collapse
-
#handle(msg) ⇒ Object
A message is a 2 element array [:type, :command, [args]].
-
#initialize(recorder, logger) ⇒ Router
constructor
If/When we add different types, this signature should change to a hash of => Object, rather than building it in the initializer here.
Constructor Details
#initialize(recorder, logger) ⇒ Router
If/When we add different types, this signature should change to a hash of => Object, rather than building it in the initializer here.
Keys of routes should be strings
11 12 13 14 15 16 17 |
# File 'lib/scout_apm/remote/router.rb', line 11 def initialize(recorder, logger) @routes = { 'record' => recorder } @logger = logger end |
Instance Attribute Details
#logger ⇒ Object (readonly)
Returns the value of attribute logger.
4 5 6 |
# File 'lib/scout_apm/remote/router.rb', line 4 def logger @logger end |
#routes ⇒ Object (readonly)
Returns the value of attribute routes.
5 6 7 |
# File 'lib/scout_apm/remote/router.rb', line 5 def routes @routes end |
Instance Method Details
#handle(msg) ⇒ Object
A message is a 2 element array [:type, :command, [args]]. For this first creation, this should be [‘record’, ‘record’, [TrackedRequest]] (the args arg should always be an array, even w/ only 1 item)
Where
type: ['recorder']
command: any function supported on that type of object
args: any array of arguments
Raises on unknown message
Returns whatever the recipient object returns
30 31 32 33 34 |
# File 'lib/scout_apm/remote/router.rb', line 30 def handle(msg) = Remote::Message.decode(msg) assert_type() call_route() end |