lib/hanami/model/migrator/connection.rb in hanami-model-1.3.2 vs lib/hanami/model/migrator/connection.rb in hanami-model-1.3.3
- old
+ new
@@ -1,7 +1,9 @@
-require 'cgi'
+# frozen_string_literal: true
+require "cgi"
+
module Hanami
module Model
class Migrator
# Sequel connection wrapper
#
@@ -34,21 +36,21 @@
# Even when adapter doesn't provide it explicitly it tries to parse
#
# @since 0.5.0
# @api private
def host
- @host ||= parsed_uri.host || parsed_opt('host')
+ @host ||= parsed_uri.host || parsed_opt("host")
end
# Returns DB connection port
#
# Even when adapter doesn't provide it explicitly it tries to parse
#
# @since 0.5.0
# @api private
def port
- @port ||= parsed_uri.port || parsed_opt('port').to_i.nonzero?
+ @port ||= parsed_uri.port || parsed_opt("port").to_i.nonzero?
end
# Returns DB name from conenction
#
# Even when adapter doesn't provide it explicitly it tries to parse
@@ -83,21 +85,21 @@
# Even when adapter doesn't provide it explicitly it tries to parse
#
# @since 0.5.0
# @api private
def user
- @user ||= parsed_opt('user') || parsed_uri.user
+ @user ||= parsed_opt("user") || parsed_uri.user
end
# Returns user from DB connection
#
# Even when adapter doesn't provide it explicitly it tries to parse
#
# @since 0.5.0
# @api private
def password
- @password ||= parsed_opt('password') || parsed_uri.password
+ @password ||= parsed_opt("password") || parsed_uri.password
end
# Returns DB connection URI directly from adapter
#
# @since 0.5.0
@@ -109,26 +111,26 @@
# Returns DB connection wihout specifying database name
#
# @since 0.5.0
# @api private
def global_uri
- uri.sub(parsed_uri.select(:path).first, '')
+ uri.sub(parsed_uri.select(:path).first, "")
end
# Returns a boolean telling if a DB connection is from JDBC or not
#
# @since 0.5.0
# @api private
def jdbc?
- !uri.scan('jdbc:').empty?
+ !uri.scan("jdbc:").empty?
end
# Returns database connection URI instance without JDBC namespace
#
# @since 0.5.0
# @api private
def parsed_uri
- @parsed_uri ||= URI.parse(uri.sub('jdbc:', ''))
+ @parsed_uri ||= URI.parse(uri.sub("jdbc:", ""))
end
# @api private
def schema
configuration.schema