hanami-db 2.2.1 → 2.3.0.beta1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: c14d718d56a8fd27676a70a6f2766ba9f0ca4af94da76feb42f7c1a02f76bf09
4
- data.tar.gz: 13aa7f195f960cba9b0ab6099035e21eb212d4f7c134dd8f09d5331e08134829
3
+ metadata.gz: 57395184c9b8e8bb62e8a262b43619ebb65926cf54f330bd6cb86790ac3e2fa3
4
+ data.tar.gz: 87faa8ebb6804f1aa2327a755a454dacb7d57f82421ee346e722fdf2254219cf
5
5
  SHA512:
6
- metadata.gz: cc7cdcd75e7129eda32912c4469ae3a42b68776d522b5e29612e279f3ea29117a4fbc73f03d9ab50c1bca72e1a0a6d8f4280e693da8c46662490da03550669ac
7
- data.tar.gz: 4920518d08540fa387e61bd151f91e97042345a15dbe079ede95fcd210e00787aa8fe9528dfbc4cae5ab77b0bd8fd6a50507a46acfca53b660db35ebd5376a58
6
+ metadata.gz: 91b1d1a95030972f7a4270aac875553a4dc106a41da20fd95d022d424d4cfdf163f559818c6b5e34968ff1554413993a8af221c4a764e16c9fc7033a775ef79b
7
+ data.tar.gz: ec39b351eadd7511952b2ef169deba334c985477e9791b6e3367ed543b7457786bc14ed1f26013503a2085d465f6d4b361e54074f7aa6e58504c07d88d43554a
@@ -21,87 +21,26 @@ module Hanami
21
21
  # @api private
22
22
  # @since 2.2.0
23
23
  def database_url(url)
24
- url = parse_url(url)
24
+ # URI#dup does not duplicate internal instance
25
+ # variables, making mutation dangerous.
26
+ url = URI(url.to_s)
25
27
 
26
28
  case deconstruct_url(url)
27
- in { scheme: "sqlite", opaque: nil, path: } unless path.nil?
29
+ in {scheme: "sqlite", opaque: nil, path:} unless path.nil?
28
30
  url.path = database_filename(path)
29
- in { path: String => path } if path =~ DATABASE_NAME_MATCHER
31
+ in {path: String => path} if path =~ DATABASE_NAME_MATCHER
30
32
  url.path = path.sub(DATABASE_NAME_MATCHER, DATABASE_NAME_SUFFIX)
31
- in { path: String => path } unless path.end_with?(DATABASE_NAME_SUFFIX)
33
+ in {path: String => path} unless path.end_with?(DATABASE_NAME_SUFFIX)
32
34
  url.path << DATABASE_NAME_SUFFIX
33
35
  else
34
36
  # do nothing
35
37
  end
36
38
 
37
- stringify_url(url)
39
+ url.to_s
38
40
  end
39
41
 
40
42
  private
41
43
 
42
- # @api private
43
- # @since 2.2.0
44
- def parse_url(url)
45
- if url.is_a?(URI::Generic)
46
- # URI#dup does not duplicate internal instance
47
- # variables, making mutation dangerous.
48
- URI(stringify_url(url))
49
- else
50
- URI(url.to_s)
51
- end
52
- end
53
-
54
- # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity
55
-
56
- # Work around a bug in Ruby 3.0.x that erroneously omits
57
- # the '//' prefix from hierarchical URLs.
58
- #
59
- # @api private
60
- # @since 2.2.0
61
- def stringify_url(url)
62
- if Gem::Version.new(RUBY_VERSION) >= Gem::Version.new("3.1.0")
63
- return url.to_s
64
- end
65
-
66
- require "stringio"
67
-
68
- buf = StringIO.new
69
- buf << url.scheme
70
- buf << ":"
71
- buf << (url.opaque || "//")
72
-
73
- if url.user || url.password
74
- buf << "#{url.user}:#{url.password}@"
75
- end
76
-
77
- if url.host
78
- buf << url.host
79
- end
80
-
81
- if url.port
82
- buf << ":"
83
- buf << url.port
84
- end
85
-
86
- if url.path
87
- buf << url.path
88
- end
89
-
90
- if url.query
91
- buf << "?"
92
- buf << url.query
93
- end
94
-
95
- if url.fragment
96
- buf << "#"
97
- buf << url.fragment
98
- end
99
-
100
- buf.string
101
- end
102
-
103
- # rubocop:enable Metrics/AbcSize, Metrics/PerceivedComplexity
104
-
105
44
  # Deconstructs a URI::Generic for pattern-matching.
106
45
  #
107
46
  # @param url [URI] Database URL parsed as URI::Generic
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Hanami
4
4
  module DB
5
- VERSION = "2.2.1"
5
+ VERSION = "2.3.0.beta1"
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hanami-db
3
3
  version: !ruby/object:Gem::Version
4
- version: 2.2.1
4
+ version: 2.3.0.beta1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hanami team
8
8
  bindir: bin
9
9
  cert_chain: []
10
- date: 2025-01-10 00:00:00.000000000 Z
10
+ date: 1980-01-02 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: rom
@@ -62,8 +62,8 @@ email:
62
62
  executables: []
63
63
  extensions: []
64
64
  extra_rdoc_files:
65
- - README.md
66
65
  - LICENSE.md
66
+ - README.md
67
67
  files:
68
68
  - LICENSE.md
69
69
  - README.md
@@ -100,7 +100,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
100
100
  - !ruby/object:Gem::Version
101
101
  version: '0'
102
102
  requirements: []
103
- rubygems_version: 3.6.2
103
+ rubygems_version: 3.6.9
104
104
  specification_version: 4
105
105
  summary: The database layer for Hanami apps
106
106
  test_files: []