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.



12
13
14
15
# File 'lib/fluent/plugin/gcloud_pubsub/client.rb', line 12

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

Instance Attribute Details

#attributesObject (readonly)

Returns the value of attribute attributes.



11
12
13
# File 'lib/fluent/plugin/gcloud_pubsub/client.rb', line 11

def attributes
  @attributes
end

#messageObject (readonly)

Returns the value of attribute message.



11
12
13
# File 'lib/fluent/plugin/gcloud_pubsub/client.rb', line 11

def message
  @message
end

Instance Method Details

#bytesizeObject



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

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