Class: Reviewer::Command::String::Env

Inherits:
Object
  • Object
show all
Defined in:
lib/reviewer/command/string/env.rb

Overview

Assembles tool environment variables into a single string or array

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(env_pairs) ⇒ self

Creates an instance of env variables for a tool to help generate the command string

Parameters:

  • env_pairs (Hash)
    description


14
15
16
# File 'lib/reviewer/command/string/env.rb', line 14

def initialize(env_pairs)
  @env_pairs = env_pairs
end

Instance Attribute Details

#env_pairsObject (readonly)

Returns the value of attribute env_pairs.



8
9
10
# File 'lib/reviewer/command/string/env.rb', line 8

def env_pairs
  @env_pairs
end

Instance Method Details

#to_aObject



22
23
24
25
26
# File 'lib/reviewer/command/string/env.rb', line 22

def to_a
  env = []
  env_pairs.each { |key, value| env << env(key, value) }
  env
end

#to_sObject



18
19
20
# File 'lib/reviewer/command/string/env.rb', line 18

def to_s
  to_a.compact.join(' ')
end