lib/hanami/model/migrator/connection.rb in hanami-model-1.2.0 vs lib/hanami/model/migrator/connection.rb in hanami-model-1.3.0.beta1
- old
+ new
@@ -1,5 +1,7 @@
+require 'cgi'
+
module Hanami
module Model
class Migrator
# Sequel connection wrapper
#
@@ -151,11 +153,14 @@
#
# @param option [String] which option from database connection will be extracted from URI
#
# @since 0.5.0
# @api private
- def parsed_opt(option)
- parsed_uri.to_s.match(/[\?|\&]#{ option }=(\w+)\&?/).to_a.last
+ def parsed_opt(option, query: parsed_uri.query)
+ return if query.nil?
+
+ @parsed_query_opts ||= CGI.parse(query)
+ @parsed_query_opts[option].to_a.last
end
end
end
end
end