Class: Skyfall::Firehose::LabelsMessage

Inherits:
Message
  • Object
show all
Defined in:
lib/skyfall/firehose/labels_message.rb

Overview

A message which includes one or more labels (as Label). This type of message is only sent from a :subscribe_labels firehose from a labeller service.

Note: the Message#did and Message#time properties are always nil for #labels messages.

Instance Attribute Summary collapse

Attributes inherited from Message

#data_object, #did, #seq, #type, #type_object

Instance Method Summary collapse

Methods inherited from Message

#inspect, new, #operations, #time, #unknown?

Constructor Details

#initialize(type_object, data_object) ⇒ LabelsMessage

Returns a new instance of LabelsMessage.

Parameters:

  • type_object (Hash)

    first decoded CBOR frame with metadata

  • data_object (Hash)

    second decoded CBOR frame with payload

Raises:

  • (DecodeError)

    if the message doesn’t include required data



27
28
29
30
31
32
# File 'lib/skyfall/firehose/labels_message.rb', line 27

def initialize(type_object, data_object)
  super
  check_if_not_nil 'seq', 'labels'

  @labels = @data_object['labels'].map { |x| Label.new(x) }
end

Instance Attribute Details

#labelsArray<Skyfall::Label> (readonly)

Returns labels included in the batch.

Returns:



19
20
21
# File 'lib/skyfall/firehose/labels_message.rb', line 19

def labels
  @labels
end