class Vx::Builder::BuildConfiguration::Env

Attributes

attributes[R]

Public Class Methods

new(new_env) click to toggle source
# File lib/vx/builder/build_configuration/env.rb, line 8
def initialize(new_env)
  normalize_attributes(new_env)
end

Public Instance Methods

global() click to toggle source
# File lib/vx/builder/build_configuration/env.rb, line 16
def global
  @attributes["global"]
end
matrix() click to toggle source
# File lib/vx/builder/build_configuration/env.rb, line 12
def matrix
  @attributes["matrix"]
end

Private Instance Methods

normalize_attributes(new_env) click to toggle source
# File lib/vx/builder/build_configuration/env.rb, line 22
def normalize_attributes(new_env)

  @attributes =
    case new_env
    when String
      {
        "matrix" => [],
        "global" => Array(new_env)
      }
    when Hash
      {
        "matrix" => Array(new_env['matrix']),
        "global" => Array(new_env['global'])
      }
    else
      env = Array(new_env).flatten.select{|i| i.is_a?(String) }
      if env.size == 1
        { "matrix" => [], "global" => env }
      else
        { "matrix" => env, "global" => [] }
      end
    end

end