Class: Fluent::GcloudPubSub::Message

Inherits:
Object
  • Object
show all
Defined in:
lib/fluent/plugin/gcloud_pubsub/client.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(message, attributes = {}) ⇒ Message

Returns a new instance of Message.



20
21
22
23
# File 'lib/fluent/plugin/gcloud_pubsub/client.rb', line 20

def initialize(message, attributes = {})
  @message = message
  @attributes = attributes
end

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



18
19
20
# File 'lib/fluent/plugin/gcloud_pubsub/client.rb', line 18

def attributes
  @attributes
end

#messageObject (readonly)

Returns the value of attribute message.



18
19
20
# File 'lib/fluent/plugin/gcloud_pubsub/client.rb', line 18

def message
  @message
end

Instance Method Details

#bytesizeObject



25
26
27
28
29
30
31
# File 'lib/fluent/plugin/gcloud_pubsub/client.rb', line 25

def bytesize
  attr_size = 0
  @attributes.each do |key, val|
    attr_size += key.bytesize + val.bytesize
  end
  @message.bytesize + attr_size
end