Class: WPDB::Config::WPConfig
- Inherits:
-
Object
- Object
- WPDB::Config::WPConfig
- Includes:
- ConfigFormat
- Defined in:
- lib/ruby-wpdb/config.rb
Instance Method Summary collapse
Methods included from ConfigFormat
Instance Method Details
#parse ⇒ Object
36 37 38 39 40 41 42 43 44 45 |
# File 'lib/ruby-wpdb/config.rb', line 36 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 |