Module: WPDB::Config::ConfigFormat
Instance Method Summary collapse
Instance Method Details
#config ⇒ Object
17 18 19 20 21 22 23 24 25 |
# File 'lib/ruby-wpdb/config.rb', line 17 def config uri = 'mysql2://' uri += "#{@config['username']}:#{@config['password']}" uri += "@#{@config['hostname']}" uri += ":#{@config['port']}" if @config['port'] uri += "/#{@config['database']}" { uri: uri, prefix: @config['prefix'] } end |
#initialize(file) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/ruby-wpdb/config.rb', line 7 def initialize(file) if file.respond_to? :read @contents = file.read else @contents = File.read(file) end parse end |