Class: Kernai::Recorder::Sink::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/kernai/recorder.rb

Overview

Abstract base declaring the full sink surface. Custom sinks can subclass this or simply implement ‘#record` on a plain object —both are accepted.

Direct Known Subclasses

CompositeSink, MemorySink

Instance Method Summary collapse

Instance Method Details

#clear!Object



35
36
37
# File 'lib/kernai/recorder.rb', line 35

def clear!
  # Default no-op
end

#entriesObject

A sink that does not materialise entries (e.g. a DB writer) returns an empty array so the Recorder’s query helpers stay safe to call but yield nothing.



31
32
33
# File 'lib/kernai/recorder.rb', line 31

def entries
  []
end

#record(_entry) ⇒ Object

Raises:

  • (NotImplementedError)


24
25
26
# File 'lib/kernai/recorder.rb', line 24

def record(_entry)
  raise NotImplementedError, "#{self.class}#record must be implemented"
end