Class: Packer::Message::TemplateVariable

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

Overview

Message representing a user variable defined within the template

Instance Attribute Summary collapse

Attributes inherited from Base

#data, #target, #timestamp, #type

Class Method Summary collapse

Instance Attribute Details

#defaultObject

The default value of the variable



11
12
13
# File 'lib/packer/message/template_variable.rb', line 11

def default
  @default
end

#nameObject

The name of the variable



8
9
10
# File 'lib/packer/message/template_variable.rb', line 8

def name
  @name
end

#requiredObject

If non-zero, then this variable is required



14
15
16
# File 'lib/packer/message/template_variable.rb', line 14

def required
  @required
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>)


18
19
20
21
22
23
24
25
26
27
28
# File 'lib/packer/message/template_variable.rb', line 18

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.name = fields[3]
  msg.default = fields[4]
  msg.required = fields[5]
  msg
end