Class: EndpointSecurity::Recorder
- Inherits:
-
Object
- Object
- EndpointSecurity::Recorder
- Defined in:
- lib/endpoint_security/recorder.rb
Overview
Writes subscribed events as newline-delimited JSON.
Instance Method Summary collapse
-
#initialize(events:, out: $stdout, **client_options) ⇒ Recorder
constructor
A new instance of Recorder.
-
#run ⇒ Client
Starts recording and blocks until the client stops.
Constructor Details
#initialize(events:, out: $stdout, **client_options) ⇒ Recorder
Returns a new instance of Recorder.
10 11 12 13 14 |
# File 'lib/endpoint_security/recorder.rb', line 10 def initialize(events:, out: $stdout, **) @events = events @out = out @client_options = end |
Instance Method Details
#run ⇒ Client
Starts recording and blocks until the client stops.
18 19 20 21 22 23 24 |
# File 'lib/endpoint_security/recorder.rb', line 18 def run Client.open(**@client_options) do |client| client.subscribe(@events) @events.each { |event| client.on(event) { || @out.puts(JSON.generate(.to_h)) } } client.run end end |