class WPDB::Config::WPConfig

Public Instance Methods

parse() click to toggle source
# File lib/ruby-wpdb/config.rb, line 39
def parse
  config = Hash[@contents.scan(/define\((?:'|")(.+)(?:'|"), *(?:'|")(.+)(?:'|")\)/)]
  @config = {
    "username" => config["DB_USER"],
    "password" => config["DB_PASSWORD"],
    "hostname" => config["DB_HOST"],
    "database" => config["DB_NAME"],
    "prefix"   => config["DB_PREFIX"] || "wp_"
  }
end