Class: Covalence::Context

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Validations
Defined in:
lib/covalence/core/entities/context.rb

Overview

Maybe just call this targets

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}, *args) ⇒ Context

Returns a new instance of Context.



19
20
21
22
# File 'lib/covalence/core/entities/context.rb', line 19

def initialize(attributes = {}, *args)
  super
  self.valid?
end

Instance Method Details

#namespaceObject



24
25
26
27
# File 'lib/covalence/core/entities/context.rb', line 24

def namespace
  return "" if name.blank?
  "#{name}:"
end

#to_command_optionsObject



29
30
31
# File 'lib/covalence/core/entities/context.rb', line 29

def to_command_options
  values.map { |value| "-target=\"#{value}\"" }
end

#to_packer_command_optionsObject



33
34
35
36
# File 'lib/covalence/core/entities/context.rb', line 33

def to_packer_command_options
  return "" if values.blank?
  "-only=#{values.join(',')}"
end