Class: Kernai::Recorder::Sink::MemorySink
- Defined in:
- lib/kernai/recorder.rb
Overview
Bundled sink that keeps every entry in a thread-safe Array.
Instance Attribute Summary collapse
-
#entries ⇒ Object
readonly
Returns the value of attribute entries.
Instance Method Summary collapse
- #clear! ⇒ Object
-
#initialize ⇒ MemorySink
constructor
A new instance of MemorySink.
- #record(entry) ⇒ Object
Constructor Details
#initialize ⇒ MemorySink
Returns a new instance of MemorySink.
44 45 46 47 48 |
# File 'lib/kernai/recorder.rb', line 44 def initialize super @entries = [] @mutex = Mutex.new end |
Instance Attribute Details
#entries ⇒ Object (readonly)
Returns the value of attribute entries.
42 43 44 |
# File 'lib/kernai/recorder.rb', line 42 def entries @entries end |
Instance Method Details
#clear! ⇒ Object
54 55 56 |
# File 'lib/kernai/recorder.rb', line 54 def clear! @mutex.synchronize { @entries.clear } end |
#record(entry) ⇒ Object
50 51 52 |
# File 'lib/kernai/recorder.rb', line 50 def record(entry) @mutex.synchronize { @entries << entry } end |