Method: Wpify::Parser#parse

Defined in:
lib/wpify/parser.rb

#parseObject

Parse all the files in @files and add the configuration hash to @wpconfig



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/wpify/parser.rb', line 23

def parse
  @wpconfig = Hash.new
  @files.each do |f|
    f = File.expand_path(f)
    next if not File.exist?(f)
    raw = File.open(f).read
    raw.scan(constant_pattern).each {|c| @wpconfig[c[0].downcase.to_sym] = c[1] }
    raw.scan(var_pattern).each {|v| @wpconfig[v[0].downcase.to_sym] = v[1] }
  end
  @wpconfig
end