Class: Dtn::Streaming::MessagesRecorderObserver
- Inherits:
-
Object
- Object
- Dtn::Streaming::MessagesRecorderObserver
- Defined in:
- lib/dtn/streaming/messages_recorder_observer.rb
Overview
A sample class, which will record all messages, which were invoked by the client. It will spy and record all invocations for simpler further analyses
It’s costly for production use, but very convenient for dev & testing purposes to quickly understand what you will get from the API
Instance Method Summary collapse
- #invoked_methods ⇒ Object
- #method_missing(method_name, **opts) ⇒ Object
- #respond_to_missing? ⇒ Boolean
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, **opts) ⇒ Object
17 18 19 |
# File 'lib/dtn/streaming/messages_recorder_observer.rb', line 17 def method_missing(method_name, **opts) invoked_methods[method_name] << opts[:message] end |
Instance Method Details
#invoked_methods ⇒ Object
13 14 15 |
# File 'lib/dtn/streaming/messages_recorder_observer.rb', line 13 def invoked_methods @invoked_methods ||= Hash.new { |h, k| h[k] = [] } end |
#respond_to_missing? ⇒ Boolean
21 22 23 |
# File 'lib/dtn/streaming/messages_recorder_observer.rb', line 21 def respond_to_missing?(*) true end |