Class: Redisse::TestPublisher Private

Inherits:
Object
  • Object
show all
Defined in:
lib/redisse/publisher.rb

Overview

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Publisher that stores events in memory for easy testing.

See Redisse#test_mode!.

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (TestPublisher) initialize

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of TestPublisher



30
31
32
# File 'lib/redisse/publisher.rb', line 30

def initialize
  @published = []
end

Instance Attribute Details

- (Object) filter

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



36
37
38
# File 'lib/redisse/publisher.rb', line 36

def filter
  @filter
end

- (Object) published (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



34
35
36
# File 'lib/redisse/publisher.rb', line 34

def published
  @published
end

Instance Method Details

- (Object) publish(channel, data, type)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



38
39
40
41
# File 'lib/redisse/publisher.rb', line 38

def publish(channel, data, type)
  return if filter && !(filter === type)
  @published << TestEvent.new(channel, data, type)
end