Class: Packer::Message::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/packer/message/base.rb

Overview

Base class for all message types

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Attribute Details

#dataObject

Zero or more values associated with the message type



15
16
17
# File 'lib/packer/message/base.rb', line 15

def data
  @data
end

#targetObject

Target of the following output



9
10
11
# File 'lib/packer/message/base.rb', line 9

def target
  @target
end

#timestampObject

Unix timestamp in UTC of when the message was printed



6
7
8
# File 'lib/packer/message/base.rb', line 6

def timestamp
  @timestamp
end

#typeObject

Type of message outputted by Packer



12
13
14
# File 'lib/packer/message/base.rb', line 12

def type
  @type
end

Class Method Details

.from_fields(fields) ⇒ Object

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.

Parameters:

  • fields (Array<String>)


19
20
21
22
23
24
25
26
# File 'lib/packer/message/base.rb', line 19

def self.from_fields(fields)
  msg = new
  msg.timestamp = fields[0]
  msg.target = fields[1]
  msg.type = fields[2]
  msg.data = fields[3..-1]
  msg
end