Method: ErlangConfigFile.turn_to_hash

Defined in:
lib/inspec/utils/erlang_parser.rb

.turn_to_hash(t) ⇒ Object



181
182
183
184
185
186
187
# File 'lib/inspec/utils/erlang_parser.rb', line 181

def self.turn_to_hash(t)
  if t.is_a?(Array) && t.all? { |x| x.class == ErlangTransform::Tuple && x.length == 2 }
    Hash[t.map { |i| [i[0], turn_to_hash(i[1])] }]
  else
    t
  end
end