Module: WPDB::Config::ConfigFormat
Instance Method Summary collapse
Instance Method Details
#config ⇒ Object
14 15 16 17 18 19 20 21 22 |
# File 'lib/ruby-wpdb/config.rb', line 14 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
4 5 6 7 8 9 10 11 12 |
# File 'lib/ruby-wpdb/config.rb', line 4 def initialize(file) if file.respond_to? :read @contents = file.read else @contents = File.read(file) end parse end |