Class: ConfCtl::HealthChecks::Systemd::PropertyList

Inherits:
Hash
  • Object
show all
Defined in:
lib/confctl/health_checks/systemd/property_list.rb

Class Method Summary collapse

Class Method Details

.from_enumerator(it) ⇒ Object



3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# File 'lib/confctl/health_checks/systemd/property_list.rb', line 3

def self.from_enumerator(it)
  hash = new

  it.each do |line|
    stripped = line.strip
    eq = line.index('=')
    next if eq.nil?

    k = line[0..(eq - 1)]
    v = line[(eq + 1)..]

    hash[k] = v
  end

  hash
end