class ErlangConfigFile
Public Class Methods
parse(content)
click to toggle source
# File lib/inspec/utils/erlang_parser.rb, line 177 def self.parse(content) lex = ErlangParser.new.parse(content) tree = ErlangTransform.new.apply(lex) turn_to_hash(tree) end
turn_to_hash(t)
click to toggle source
# File lib/inspec/utils/erlang_parser.rb, line 183 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