Class: LinuxEnvironmentReader

Inherits:
Reader
  • Object
show all
Defined in:
lib/teuton-get/reader/linux_environment_reader.rb

Instance Method Summary collapse

Methods inherited from Reader

#source

Constructor Details

#initialize(command) ⇒ LinuxEnvironmentReader

Returns a new instance of LinuxEnvironmentReader.



4
5
6
# File 'lib/teuton-get/reader/linux_environment_reader.rb', line 4

def initialize(command)
  @command = command
end

Instance Method Details

#readObject



8
9
10
11
12
13
14
15
16
17
18
# File 'lib/teuton-get/reader/linux_environment_reader.rb', line 8

def read
  lines = @command.split("\n")
  data = {}
  lines.sort.each do |line|
    items = line.split("=")
    if items.size == 2
      data[items[0].strip] = items[1].strip
    end
  end
  data
end