Class: Stenotype::Adapters::TestAdapter

Inherits:
Base
  • Object
show all
Defined in:
lib/stenotype/adapters/test_adapter.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#auto_initialize!

Constructor Details

#initialize(*_) ⇒ TestAdapter

Returns a new instance of TestAdapter.



8
9
10
11
# File 'lib/stenotype/adapters/test_adapter.rb', line 8

def initialize(*_)
  @buffer = Array.new
  super()
end

Instance Attribute Details

#bufferObject (readonly)

Returns the value of attribute buffer.



6
7
8
# File 'lib/stenotype/adapters/test_adapter.rb', line 6

def buffer
  @buffer
end

Instance Method Details

#flush!Object

Clears the buffer



24
25
26
# File 'lib/stenotype/adapters/test_adapter.rb', line 24

def flush!
  buffer.clear
end

#publish(event_data, **additional_attrs) ⇒ Object

Parameters:

  • event_data (Sting)

    The data to be published

  • additional_attrs (Hash)

    The list of additional event attributes



17
18
19
# File 'lib/stenotype/adapters/test_adapter.rb', line 17

def publish(event_data, **additional_attrs)
  buffer << parse(event_data)
end