Class: Redisse::TestEvent

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

Overview

An event in test mode.

You can re-open or add modules to this class if you want to add behavior to events found in Redisse#published for easier testing.

Examples:

class Redisse::TestEvent
  def yml
    YAML.load data
  end
def private?
    channel.start_with? 'private'
  end
end

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Instance Attribute Details

- (Object) channel

Returns the value of attribute channel

Returns:

  • (Object)

    the current value of channel



45
46
47
# File 'lib/redisse/publisher.rb', line 45

def channel
  @channel
end

- (Object) data

Returns the value of attribute data

Returns:

  • (Object)

    the current value of data



45
46
47
# File 'lib/redisse/publisher.rb', line 45

def data
  @data
end

- (Object) type

Returns the value of attribute type

Returns:

  • (Object)

    the current value of type



45
46
47
# File 'lib/redisse/publisher.rb', line 45

def type
  @type
end

Instance Method Details

- (Object) json

Helper method to parse the Event data as JSON.



66
67
68
# File 'lib/redisse/publisher.rb', line 66

def json
  JSON.parse(data)
end